DBCC CHECKIDENT
Check the current Identifier value of the specified table. If necessary, correct the Identifier value.
Syntax
DBCC CHECKIDENT
('Table_name'
[,{NORESEED
| {RESEED [, New_reseed_value]}
}
]
)
Parameters
'Table_name'
Is the name of the table whose current identity value is to be checked. The table name must comply with the identifier rules. For more information, see use identifiers. The specified table must contain an ID column.
NORESEED
Specifies that the current ID value should not be corrected.
RESEED
Specifies that the current ID value should be corrected.
New_reseed_value
Is the value to be used when the value is re-assigned in the ID column.
Example A. Reset the current ID value if necessary
The following example is reset if necessary.JobsThe current Identifier value of the table.
USE pubsGODBCC CHECKIDENT (jobs)GO
B. report the current ID value
Example reportJobsThe current ID value in the table. If the id value is incorrect, it is not corrected.
USE pubsGODBCC CHECKIDENT (jobs, NORESEED)GO
C. Force the current ID value to 30
Force the following exampleJobsThe current ID value in the table is 30.
USE pubsGODBCC CHECKIDENT (jobs, RESEED, 30)GO