DATETIME 1067 error

[expired user #8996]'s profile image [expired user #8996] posted 9 years ago in General Permalink
Hi all,
I am a newbie at SQL and happily found HEIDI here.

Anyway I have begun a database and added a column DATETIME which, when I save gives a 1067 error. Any idea why?

Thanks for your time.

1 attachment(s):
  • user_db
[expired user #8996]'s profile image [expired user #8996] posted 9 years ago Permalink
To be more specific the copy reads. Invalid default value for 'reg_date'.
kalvaro's profile image kalvaro posted 9 years ago Permalink
Clearly, zero is not a valid date. What do you want to accomplish?
[expired user #8996]'s profile image [expired user #8996] posted 9 years ago Permalink
Hi
Thanks for the assistance. I am wanting to create a user's database. Not sure which zero you mean....But I have redone it and it works now. I don't understand why!
kalvaro's profile image kalvaro posted 9 years ago Permalink
Which zero I mean? The one stated in the error message:

Invalid default value for 'reg_date'

You've enclosed a screenshot where you attempt to create a table with a column called "reg_date" of type "DATETIME", which cannot be empty and with a default value of zero. Unlike other error messages, this one is rather direct.

I suspect you're thinking of relational databases like some kind of Excel-like spreadsheet, where you can type arbitrary values in any cell. Thankfully, that's not how relational databases work. Wherever you want something empty you have to use NULL, not zero or any other value.




Please login to leave a reply, or register at first.