Skip to content
Advertisement

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.

Advertisement

Answer

You can rename using sp_rename using @objtype = 'OBJECT'

This works on objects listed in sys.objects which includes constraints

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement