tsql - How to rename primary key constraint in SQL Server -


i have pk constraint on table notes named pk_dbo.notes , want rename pk_notes using sql server ddl, i.e. not using ssms rename menu option.

mentioned in another question's answers queries don't work me. that thread's answers helpful, don't work too.

sometimes need explicitly wrap names in square brackets, this:

sp_rename @objname = n'[notes].[pk_dbo.notes]', @newname = n'pk_notes' 

i think it's because of dot in pk name.

also, see, pk constraints don't need @objtype = 'object' specified.


Popular posts from this blog

java - Cannot send AES encrypted messages of over 47 characters -

php - How to set default value of a select dynamically from database using smarty? -

telerik - Reformat image format in PDF -