开发者

Add default value for time(7) field

开发者 https://www.devze.com 2023-02-06 15:06 出处:网络
How can I add a default value for time(7) field in SQL Server ? I tried to set \"00:00:00\"开发者_JS百科 to \"default value or binding\" in SQL Server Management Studio but it didn\'t work.Use this T

How can I add a default value for time(7) field in SQL Server ?

I tried to set "00:00:00"开发者_JS百科 to "default value or binding" in SQL Server Management Studio but it didn't work.


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:

Add default value for time(7) field

Put your time into single quotes, and put brackets around the value.

0

精彩评论

暂无评论...
验证码 换一张
取 消