Hi;

I have an sql database with a table called: "stardate" with default value set up with "dat" I want to modify this column default value to current date (server side) I'm trying this:

Alter table my_table 
Modify startdate DATE  DEFAULT CURRENT_TIMESTAMP;

with this error: Error Code: 1067. Invalid default value for 'startdate'

I'm working with workbench and last sql server on local. And i'm tourning crazy!! any idea?

Thanks in advance!!

Recommended Answers

All 3 Replies

use this instead.... replace date to timestamp...; hope it will help =)

ALTER TABLE table_name
 MODIFY COLUMN  column_name TIMESTAMP DEFAULT CURRENT_TIMESTAMP;

well, it works, but, another question: doing this are we forcing to introduce current DATE to the user or "forcing" our server to "stamp" current date?

Thanks in advance again!

forcing the server to stamp current date

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.