Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Null date insert

0 views
Skip to first unread message

monkeys paw

unread,
Nov 2, 2009, 4:50:49 PM11/2/09
to
When an insert is done thru mysql and the date field is
blank, mysql puts a 0000-00-00 date in there. How do you
force a NULL value?

Captain Paralytic

unread,
Nov 2, 2009, 6:44:19 PM11/2/09
to

Well I'm not sure what you mean by "done thru mysql". MySQL is the
RDBMS so all inserts into a MySQL table are "thru[SIC]" MySQL.

However, regardless of that, if you want to force a NULL, put a NULL
in there!

toby

unread,
Nov 2, 2009, 9:37:51 PM11/2/09
to

For TIMESTAMP, you can't. See:
http://dev.mysql.com/doc/refman/5.0/en/timestamp.html

Use DATETIME if you need a nullable column.

Balwinder S Dheeman

unread,
Nov 3, 2009, 4:23:04 PM11/3/09
to

create table test (name text, dob date default NULL);
insert into test values('Ram',NULL);

--
Balwinder S "bdheeman" Dheeman Registered Linux User: #229709
Anu'z Linux@HOME (Unix Shoppe) Machines: #168573, 170593, 259192
Chandigarh, UT, 160062, India Plan9, T2, Arch/Debian/FreeBSD/XP
Home: http://werc.homelinux.net/ Visit: http://counter.li.org/

0 new messages