This is a discussion on question about datetime column in mysql within the MySQL Database forums, part of the Database Forums category; Hey there, i tried this question in the mysql group, but have not heard anything. i have a database with ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hey there,
i tried this question in the mysql group, but have not heard anything. i have a database with about 20 tables. The some of these tables have datetime type columns in them. What i am basically wondering is if there is a way to make a default value of now() apply if it is not specified when the row is created. i know this is possible with a timestamp, but is it possible with a datetime column ? and if so, how ? |
|
|||
|
nephish wrote: > Hey there, > i tried this question in the mysql group, but have not heard anything. > i have a database with about 20 tables. The some of these tables have > datetime type columns in them. What i am basically wondering is if > there is a way to make a default value of now() apply if it is not > specified when the row is created. > i know this is possible with a timestamp, but is it possible with a > datetime column ? and if so, how ? High. I think CURRENT_TIMESTAMP is meant to work, however you'd probably need to change your column to timestamp instead of date. |
|
|||
|
Daz wrote: > nephish wrote: > > Hey there, > > i tried this question in the mysql group, but have not heard anything. > > i have a database with about 20 tables. The some of these tables have > > datetime type columns in them. What i am basically wondering is if > > there is a way to make a default value of now() apply if it is not > > specified when the row is created. > > i know this is possible with a timestamp, but is it possible with a > > datetime column ? and if so, how ? > > High. I think CURRENT_TIMESTAMP is meant to work, however you'd > probably need to change your column to timestamp instead of date. thanks, i will check it out. I had actually considered using a time stamp, but did not know enough about it when i started to build. thanks again sk |