Reputation: 578
I was trying to create a column with data type time and trying to set the default value as the current time using HeidiSql. Below is the altered code.
ALTER TABLE "user"
ADD "user" TIME NULL DEFAULT CURRENT_TIME();
But it output an error as below.
syntax error at or near ")"
LINE 2: ADD "created_time" TIME NULL DEFAULT CURRENT_TIME()
Any idea about my mess?
Upvotes: 2
Views: 635
Reputation: 1269803
create table users (user_id serial);
ALTER TABLE users
ADD create_Time TIME NULL DEFAULT CURRENT_TIME;
You don't need parentheses around CURRENT_TIME
.
Some other things:
now()
/CURRENT_TIMESTAMP
?Upvotes: 2