Pages

Social Icons

Monday 27 February 2012

Reset Identity Column

If we want to check current identify value is. We can use this command to do so:


DBCC CHECKIDENT (‘tablename’, NORESEED)


If we wanted to check the next ID value of my orders table, I could use this command:


DBCC CHECKIDENT (orders, NORESEED)


To set the value of the next ID to be 100, I can use this command:


DBCC CHECKIDENT('Customer', RESEED, 99)


If we want to reset the identity column so we can use the previous command as follows:

DBCC CHECKIDENT('Customer', RESEED, 99)

No comments:

Post a Comment