I found this expression on the Internet and implemented the above function on mysql (version 5.7) provided by local wamp
<code>alter table account.users add column reg_time datetime not null default now();</code>
But I am using the same SQL statement on the server side
<code>alter table users add column reg_time datetime not null default now();</code>
But it prompts: Invalid default value for 'reg_time'
The server mysql version is 5.0
What should I do?
I found this expression on the Internet and implemented the above function on mysql (version 5.7) provided by local wamp
<code>alter table account.users add column reg_time datetime not null default now();</code>
But I am using the same SQL statement on the server side
<code>alter table users add column reg_time datetime not null default now();</code>
But it prompts: Invalid default value for 'reg_time'
The server mysql version is 5.0
What should I do?
<code>ALTER TABLE `users` ADD COLUMN `reg_time` timestamp NOT NULL ON UPDATE CURRENT_TIMESTAMP</code>
sqlserver uses getdate()
mysql which should correspond to now()
timestamp timestamp type field has two attributes: automatic update insertion time and modification time