NULL value not inserted

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
bugthefixer
Forum Contributor
Posts: 118
Joined: Mon Mar 22, 2004 2:35 am

NULL value not inserted

Post by bugthefixer »

my code is like this

Code: Select all

update train
set dep_time='NULL' where st_id=2;
datatype of dep_time is 'time'.
this query doesnt insert NULL rather inserts '00:00:00'
anybody can tell me how to insert NULL value
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

If you put single quotes around NULL, it will insert the string NULL.

You need to do this

Code: Select all

update train 
set dep_time=NULL where st_id=2;
Mark
Post Reply