Rename a constraint in SQL Server?
问题 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 and I will have to recreate/alter those. 回答1: You can rename using sp_rename using @objtype = 'OBJECT' This works on objects listed in sys.objects which includes constraints 回答2: 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'