![sql 2012 express dbcc checkident reseed sql 2012 express dbcc checkident reseed](https://imposible-oben.com/mxts/0OQcaaBQpY7cylZACtTXewHaEK.jpg)
This statement should be used only if no rows have been inserted into the table since the table was created, or if all rows have been removed by using the TRUNCATE TABLE statement. To set the IDENTITY column of a table to start from 1, the following statement can be issued:ĭBCC CHECKIDENT ( '.', RESEED, 1 ) Lastly, the WITH NO_INFOMSGS clause suppresses all informational messages. Otherwise, the next row inserted will use newreseedvalue + 1. If no rows have been inserted to the table since it was created, the first row inserted after executing DBCC CHECKIDENT will use newreseedvalue as the identity. The is the new value to be used as the current value of the identity column. DBCC CHECKIDENT ( 'tablename', RESEED, newreseedvalue) The current identity value is set to the newreseedvalue. The RESEED clause specifies that the current identity value should be changed. The NORESEED clause specifies that the current identity value should not be changed. The parameter is the name of the table for which to check the current identity value and it must contain an identity column.
![sql 2012 express dbcc checkident reseed sql 2012 express dbcc checkident reseed](https://i.stack.imgur.com/dpV0d.png)
Checking identity information: current identity value. Here’s an example: DBCC CHECKIDENT('product') This will show you the current value of this table’s identity column. You just specify the name of the table as the parameter. The syntax of the DBCC CHECKIDENT command is as follows:ĭBCC CHECKIDENT ( ) You can run the DBCC CHECKIDENT procedure in SQL Server to see what the current value of the identity column is.
![sql 2012 express dbcc checkident reseed sql 2012 express dbcc checkident reseed](https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/BlogImages/04262016234611PM/image004.png)
The DBCC CHECKIDENT can also be used to manually set a new current identity value for the identity column. The DBCC CHECKIDENT command checks the current identity value for the specified table and, if it is needed, changes the identity value. To restart or reset the values of the IDENTITY column of a table, the DBCC CHECKIDENT command can be used.