如何更改 sql 中的默认值 constraint_name?
How to change default constraint_name in sql?
如何更改 change/edit 正在显示的 constraint_name?
我们需要重命名的约束是DF__oldername__c1__7C8480AE
。现在我们需要删除约束,然后添加新约束,因为无法简单地就地更改约束。我们使用:
ALTER TABLE Tablename DROP CONSTRAINT DF__oldername__c1__7C8480AE;
ALTER TABLE Tablename ADD CONSTRAINT DF__newname__c1
DEFAULT NEWSEQUENTIALID() FOR c1;
我们完成了。
如何更改 change/edit 正在显示的 constraint_name?
我们需要重命名的约束是DF__oldername__c1__7C8480AE
。现在我们需要删除约束,然后添加新约束,因为无法简单地就地更改约束。我们使用:
ALTER TABLE Tablename DROP CONSTRAINT DF__oldername__c1__7C8480AE;
ALTER TABLE Tablename ADD CONSTRAINT DF__newname__c1
DEFAULT NEWSEQUENTIALID() FOR c1;
我们完成了。