TRUNCATE TABLE can be used to reset the identity counter,but it can 't be used on a table referenced by a foreign key when you delete all records by using DELETE command and reset the table by using the following command.
DBCC CHECKIDENT ('table_name', RESEED, new_reseed_value)
Syntax:
DBCC CHECKIDENT ('table_name', RESEED, new_reseed_value)
Tablename : Table name that you want to reset identity
RESEED : that is keyword
New Reseed Value : give new reseeding value
RESEED : that is keyword
New Reseed Value : give new reseeding value
DBCC CHECKIDENT (emp,reseed,0)
No comments:
Post a Comment