Create Primary Keys
Before you begin
About this task
Procedure
Use the following code to add a primary key:
USE <database name>
GO
ALTER TABLE <schema name>.<history table name>
ADD CONSTRAINT <history table name>_PK_Id PRIMARY KEY NONCLUSTERED
(
<Primary key column name> ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF,
IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
ON [PRIMARY]
GO
Tip:
Run the following command to verify the data integrity of the
table:
DBCC CHECKTABLE ("<schema name>.<history table name>")