Drop Primary Key

ALTER TABLE statement is used to drop a primary key in SQL Server.

Syntax:

ALTER TABLE table_name  

DROP CONSTRAINT constraint_name;

Example:

Let’s drop a primary key using the ALTER TABLE statement in SQL Server. Here we take “cricketers2” table which has “cricketer_id” as a primary key and “cricketers2_pk” as constraint name.

ALTER TABLE [javatpoint].[dbo].[cricketers2]  

DROP CONSTRAINT cricketers2_pk ;

Output:

SQL Drop primary 1

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *