How to drop primary key from a table in SQL Server

Drop command to drop Primary Key in SQL Server:

If you have created a Table (in SQL Server Database) with a Primary Key and later decided to remove/drop the Primary Key from the Table, you can use the below command to do so.

1. First identify the Name of the Primary Key.
2. Now execute the below command:

ALTER TABLE [Table_Name]DROP CONSTRAINT [Primary_Key_Name]
For example:
ALTER TABLE tblEmployee DROP CONSTRAINT PK__tblEmplo__AFB3EC6D24E777C3

Get ASP.net, C#.Net and SQL Server Interview Questions at http://dotnetprojectninterviewquestions.blogspot.com/

0 comments:

Post a Comment

top