Pages

Saturday, 16 March 2013

How to reset/set new Identity value in SQL?

We can easily change, reset, view identity value using DBCC(Database Console Commands) of SQL.

1) To Reset Current Identity Value, if needed
Syntax: DBCC CHECKIDENT ("Table_Name")
Example: DBCC CHECKIDENT ("tblCustomers")
2) To View Current Identity Value
Syntax: DBCC CHECKIDENT ("Table_Name", NORESEED)
Example: DBCC CHECKIDENT ("tblCustomers", NORESEED)
3) To Change Identity Value with New Value
Syntax: DBCC CHECKIDENT ("Table_Name", RESEED, New_Value)
Example: DBCC CHECKIDENT ("tblCustomers", RESEED, 25)

No comments:

Post a Comment