Saturday, 10 September 2016

SQL Query to reset the Identity

SQL Query to reset the Identity
Description:

In this example we explain that how to reset the identity of table in SQL Server.or Reset identity seed after deleting records in SQL Server.or How to RESET identity column values in SQL Server. As we know that when we truncate the data ,table identity will be reset automatically but when we delete the records from the tables the identity will not be reset automatically so to reset identity of the column after perform delete operation in table in SQL Server below is the SQL Query to automatically reset the identity of the column.


Syntax:

DBCC CHECKIDENT ('[TableName]', RESEED, 0);
GO

Example :

DBCC CHECKIDENT ('[Demo]', RESEED, 0);
GO

Column in above query the “Demo” is the name of the table in which we will reset the identity column of the table in SQL Server.
This entry was posted in :

0 comments:

Post a Comment