Reputation: 13
I'm using MSSQL2008. The date type is Date
, and I would like to set the default date to now or today.
I've tried GETDATE()
, but I get "Error validating the default for column 'Date'". If I persist with GETDATE()
, it doesn't work.
Upvotes: 1
Views: 2039
Reputation: 269348
GETDATE
returns a DATETIME
that you can subsequently CAST
to the DATE
type:
CAST(GETDATE() AS DATE)
Upvotes: 0
Reputation: 10598
are you sure that you are setting Date
in the correct place? according to your error message it looks like the column name is Date
, not the type; make sure the type is Date and try again, GETDATE()
as a default should work fine
Upvotes: 1