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

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo