pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Updating datetime fields with NULL values
2+ messages / 2 participants
[nested] [flat]

* Updating datetime fields with NULL values
@ 1999-11-16 22:28 Gary MacMinn <G.MacMinn@nca.gov.au>
  1999-11-16 22:58 ` Re: [SQL] Updating datetime fields with NULL values John Ziniti <ziniti@helix.mgh.harvard.edu>
  0 siblings, 1 reply; 2+ messages in thread

From: Gary MacMinn @ 1999-11-16 22:28 UTC (permalink / raw)
  To: pgsql-sql

Morning All,

Is it possible to clear a datetime field to NULL? If so, how? In trying an update (update test set d1='' where t1='Text2';) I get an error of Bad datetime external representation ''

TIA,
Gary MacMinn
===============================================
Table    = test
+----------------------------------+----------------------------------+-------+
|              Field               |              Type                | Length|
+----------------------------------+----------------------------------+-------+
| t1                               | text                             |   var |
| d1                               | datetime                         |     8 |
+----------------------------------+----------------------------------+-------+




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [SQL] Updating datetime fields with NULL values
  1999-11-16 22:28 Updating datetime fields with NULL values Gary MacMinn <G.MacMinn@nca.gov.au>
@ 1999-11-16 22:58 ` John Ziniti <ziniti@helix.mgh.harvard.edu>
  0 siblings, 0 replies; 2+ messages in thread

From: John Ziniti @ 1999-11-16 22:58 UTC (permalink / raw)
  To: pgsql-sql

Hey Gary,

Use the keyword NULL as your value:

pipeline=> create table testme (datetimetest datetime);
CREATE
pipeline=> insert into testme (datetimetest) values ('now');
INSERT 1509043 1
pipeline=> select * from testme;
datetimetest                
----------------------------
Tue Nov 16 17:56:09 1999 EST
(1 row)

pipeline=> update testme set datetimetest=NULL;
UPDATE 1
pipeline=> select * from testme;
datetimetest
------------
            
(1 row)


Gary MacMinn wrote:
> 
> Morning All,
> 
> Is it possible to clear a datetime field to NULL? If so, how? In trying an update (update test set d1='' where t1='Text2';) I get an error of Bad datetime external representation ''
> 
> TIA,
> Gary MacMinn
> ===============================================
> Table    = test
> +----------------------------------+----------------------------------+-------+
> |              Field               |              Type                | Length|
> +----------------------------------+----------------------------------+-------+
> | t1                               | text                             |   var |
> | d1                               | datetime                         |     8 |
> +----------------------------------+----------------------------------+-------+
> 
> ************

-- 
John Ziniti
Mass General Hospital
CVRC 149-4201
149 13th Street
Charlestown, MA 02129
tel (617) 726-4347
fax (617) 726-5806
ziniti@helix.mgh.harvard.edu



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~1999-11-16 22:58 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-11-16 22:28 Updating datetime fields with NULL values Gary MacMinn <G.MacMinn@nca.gov.au>
1999-11-16 22:58 ` John Ziniti <ziniti@helix.mgh.harvard.edu>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox