How can I add a default value for time(7)
field in SQL Server ?
I tried to set "00:00:00" to "default value or binding" in SQL Server Management Studio but it didn't work.
SQL Server GETDATE() Function The GETDATE() function returns the current database system date and time, in a 'YYYY-MM-DD hh:mm:ss.
Use this T-SQL statement in SSMS:
ALTER TABLE dbo.YourTable ADD CONSTRAINT DF_TimeDefault DEFAULT '00:00:00' FOR YourTimeColumn
If you want to use the visual table designer, use this notation:
Put your time into single quotes, and put brackets around the value.
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