天天看點

如何知道SQL中預設值限制名稱是什麼

如果作者沒有指定DEFAULT限制名,那麼系統會自動命名,可以用以下語句獲得該DEFAULT限制名: 

select name from sys.default_constraints
where parent_object_id=object_id('表名')
and parent_column_id=columnproperty(object_id('表名'),'列名','columnid')