Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以使用具有类型的列创建表并为其DATETIME赋予默认值,例如CURRENT_TIMESTAMPor GETDATE()?还有另一种方法可以做到这一点吗?
DATETIME
CURRENT_TIMESTAMP
GETDATE()
SSMS 2017 的屏幕截图
使用 TSQL 定义约束:
ALTER TABLE TableName ADD CONSTRAINT DF_TableName DEFAULT GETDATE() FOR ColumnName