jaysun
11-20-2002, 05:40 PM
Hi All,
First I should point out that I have read the other posts on this issue and understand the problem with enclosing the curdate() command in quotes and therefore making it text and as a result this throws the 0000-00-00 00:00:00 value into the db.........
The problem I have is that I simply can't get mySQL to recognise the curdate() command and all my inserts are the dreaded zero's :(
If i run this in mySQL it returns the date:
mysql> SELECT CURTIME();
However........if I try to run this
mysql> ALTER TABLE `album` CHANGE `date_added` `date_added` DATETIME DEFAULT curdate() NOT NULL;
I get the following error:
ERROR 1064: You have an error in your SQL syntax near 'curdate()' at line 1
If I enclose the curdate() command in quotes then the alter table SQL runs find but obviously inputs text into the date field resulting in 0000-00-00 00:00:00
Any pointers/help really appreciated :)
TIA - JaYsuN
P.S. I have a Windows 2000 setup (sorry!) and mySQL v2.32.52-nt
First I should point out that I have read the other posts on this issue and understand the problem with enclosing the curdate() command in quotes and therefore making it text and as a result this throws the 0000-00-00 00:00:00 value into the db.........
The problem I have is that I simply can't get mySQL to recognise the curdate() command and all my inserts are the dreaded zero's :(
If i run this in mySQL it returns the date:
mysql> SELECT CURTIME();
However........if I try to run this
mysql> ALTER TABLE `album` CHANGE `date_added` `date_added` DATETIME DEFAULT curdate() NOT NULL;
I get the following error:
ERROR 1064: You have an error in your SQL syntax near 'curdate()' at line 1
If I enclose the curdate() command in quotes then the alter table SQL runs find but obviously inputs text into the date field resulting in 0000-00-00 00:00:00
Any pointers/help really appreciated :)
TIA - JaYsuN
P.S. I have a Windows 2000 setup (sorry!) and mySQL v2.32.52-nt