ja660k
June 12th, 2010, 01:23 PM
Hey all.
I want to know how to add todays date in SQL as the default for a column?
my sql looks like:
mysql> create table users(
-> id int not null primary key,
-> name varchar(50) not null,
-> address varchar(50) not null,
-> phone varchar(9) not null default "0000-0000",
-> lastLogin date default curdate()
-> );
and the error
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'curdate()
)' at line 6
mysql>
i know its giving me a syntax error, but how can i get that to work?
I want to know how to add todays date in SQL as the default for a column?
my sql looks like:
mysql> create table users(
-> id int not null primary key,
-> name varchar(50) not null,
-> address varchar(50) not null,
-> phone varchar(9) not null default "0000-0000",
-> lastLogin date default curdate()
-> );
and the error
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'curdate()
)' at line 6
mysql>
i know its giving me a syntax error, but how can i get that to work?