How To ENABLE a PRIMARY KEY in MS SQL Server

Sometimes you need to enable your disabled primary key in MS SQL Server. You can enable a primary key using the ALTER INDEX statement in SQL Server. The syntax to enable a primary key using the ALTER INDEX statement in MS SQL Server is:

ALTER INDEX constraint_name
ON table_name
REBUILD;

Let’s look at an example of how to enable a primary key using the ALTER INDEX statement in MS SQL Server.

ALTER INDEX idx_tblt_emp_id_pk 
ON [DataAnalytics].[dbo].[tblt_emp]
REBUILD;

I have an another tutorial related to this tutorial where you will learn How To DISABLE a PRIMARY KEY in MS SQL Server.

In this tutorial, I have shown how to enableĀ  disabled primary key in MS SQL Server. Hope you have enjoyed the tutorial. If you want to get updated, like my facebook page http://www.facebook.com/LearningBigDataAnalytics.

Add a Comment