Is it possible to create a table with a column that has type DATETIME
and give it a default value such as CURRENT_TIMESTAMP
or GETDATE()
? Is there another way to do this?
Screenshot from SSMS 2017
Remarks. The maximum valid date for a SqlDateTime structure is December 31, 9999.
Define a constraint using TSQL:
ALTER TABLE TableName ADD CONSTRAINT DF_TableName DEFAULT GETDATE() FOR ColumnName
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With