Is it possible to rename a constraint in SQL Server? I don\'t want to have to delete and create a new one because this constraint affects other already existing constraints
I know this is an old question, but I just found the following to be very helpful, in addition to the other great answers:
If the constraint to be renamed has a period in it (dot), then you need to enclose it in square brackets, like so:
sp_rename 'schema.[Name.With.Period.In.It]', 'New.Name.With.Period.In.It'
After some more digging, I found that it actually has to be in this form:
EXEC sp_rename N'schema.MyIOldConstraint', N'MyNewConstraint', N'OBJECT'
Source
answer is true :
exec sp_rename
@objname = 'Old_Constraint',
@newname = 'New_Constraint',
@objtype = 'object'
You can rename using sp_rename using @objtype = 'OBJECT'
This works on objects listed in sys.objects which includes constraints
You can use sp_rename.
sp_rename 'CK_Ax', 'CK_Ax1'