- February 8, 2017
- Posted by: user
- Category: Uncategorized
No Comments
Easiest way to reset the identity column value in MSSQL is to use ‘TRUNCATE TABLE’ on the table.
This will reset the identity column value.This will work only if the table has no references made by any child.
Syntax:
[code:cf]
truncate table TABLENAME;
[/code]
For tables that are referenced by other tables we can use ‘DBCC CHECKINDENT’ Syntax;
[code:cf]
use databaseName;
go
DBCC CHECKIDENT (‘tableName’,’reseed’,reseedvalue)
go
[/code]