-1

How do i change change/edit the constraint_name that is being displayed?

Jay
  • 65
  • 2
  • 2
  • 6
  • 2
    Possible duplicate of [SQL Server rename a constraint?](http://stackoverflow.com/questions/8712875/sql-server-rename-a-constraint) – NP3 May 19 '17 at 11:29

1 Answers1

1

The constraint we need to rename is DF__oldername__c1__7C8480AE. Now we need to drop the constraint and then add the new one as there's no way to simply alter the constraint in-place. We do that using:

ALTER TABLE Tablename DROP CONSTRAINT DF__oldername__c1__7C8480AE;
ALTER TABLE Tablename ADD CONSTRAINT DF__newname__c1
DEFAULT NEWSEQUENTIALID() FOR c1;

and we are done.

Super User
  • 9,448
  • 3
  • 31
  • 47