Identity Column Reset

No view

- If the table contains an iden.y column, the counter for that column is reset to the seed value defined for the column. If no seed was defined, the default value 1 is used. To retain the iden.y counter, use DELETE instead. So the following: DELETE FROM [MyTable]; DBCC CHECKIDENT '[MyTable] ', . - The current iden.y value is larger than the maximum value in the table. Execute DBCC CHECKIDENT table_name, NORESEED to determine the current maximum value in the column, and then specify that value as the new_reseed_value in a DBCC CHECKIDENT table_name, RESEED,new_reseed_value command..

If you are using an iden.y column on your SQL Server tables, you can set the next insert value to w.ver value you want. An example is if you wanted to start .In this blog you will learn how to Reset Iden.y Column Values in Sql Server..I'm building a SQL script to reset a database. To do this I want to empty several not all tables and reset their iden.y values to 0. For some tables I use .I would always argue that if you care about the actual numerical values generated in an iden.y column, you're misusing them. All you should care about with an .

No related post!