Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sql #server #remove #primary #key #dropping #table
ADD COMMENT
Topic
Name
4+5 =