Can we drop and recreate primary key in SQL Server table @ Production environment? Do we have to down the server for it or we can do it live? -


can drop , recreate composite primary key in sql server table in production environment? have take down server it, or can live?

because have add more columns primary key. if done in live problems have face?

you can remove primary key table.this remove clustered index of table if have't mentioned explicitly on other column.

to remove primary key run below query

-- drop check constraint table      alter table /*schema*/./*table*/         drop constraint /*constraint_name*/      go 

and add primary key run below code

-- add new check constraint table alter table /*schema*/./*table*/     add constraint /*contraint_name*/ /*constraint_type*/ (/*constraint_column_name*/ /*logical_expression*/) go 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -