If the field has a date
format, you can make auto insert
current dates for the muscle forces like current_timestamp
for TimeStamp
?
Answer 1, Authority 100%
No, TimeStamp is an exception. For other data types, only constants can be used as Default.
In the documentation http://dev.mysql.com/doc/refman/5.5/en/ Create-Table.html
Default value Specifies the default value for the table field with one exception: the default value must be a constant, it cannot be a function or expression. For example, you cannot specify the value of the NOW () or CURRENT_DATE function for the DATE field. Exception: You can set CURRENT_TIMESTAMP as default value for TimeStamp field.
However, there are options:
- Use timestamp as data type.
- make a trigger that implements the required functionality.
Answer 2
I suggest the following solution:
convert (Current_TimeStamp, Date)