Answers for "drop primary key constraint sql server then add new one"

SQL
3

sql drop primary key

ALTER TABLE [table_name] DROP CONSTRAINT [primary_key_name]
Posted by: Guest on June-01-2021
0

sql server remove primary key without dropping table

IF EXISTS (SELECT * FROM sys.key_constraints
           WHERE type = 'PK' AND parent_object_id = OBJECT_ID('MyTable')
           AND Name = 'PK_MyTable')
    ALTER TABLE MyTable DROP CONSTRAINT PK_MyTable
Posted by: Guest on September-15-2021

Code answers related to "drop primary key constraint sql server then add new one"

Code answers related to "SQL"

Browse Popular Code Answers by Language