|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
when creating a table, i tried to define
a default value for a date column. 'contact date not null default "now()",' this doesnt do anything. is it possible to define a default (sysdate) for date columns under mysql? |
|
#2
|
|||
|
|||
|
Remove the double quotes from around now() so mysql knows you are defaulting to a function. With quotes it tries to insert the text "now()" which isn't valid for a date field and results in zeroes.
|
|
#3
|
|||
|
|||
|
mysql>
mysql> create table test (name varchar(32), datum date default now()); ERROR 1064: You have an error in your SQL syntax near 'now())' at line 1 mysql> i tried this too, but... do you have another suggestion? |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > how to setup a default value for date columns |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|