Reputation: 3491
How can I reset identity field in a table in database by '0' value?
I used of this script:
DBCC CHECKIDENT({table name}, reseed, 0)
But this has a error by this message :
Incorrect syntax near CHECKIDENT
What is CHECKIDENT?
Upvotes: 0
Views: 500
Reputation: 755421
I don't know what you're doing - but this works perfectly well for me:
DBCC CHECKIDENT('EMP', reseed, 0)
Results in:
Checking identity information: current identity value '12', current column value '0'.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
You need to make sure to put your table name into single quotes: use 'EMP'
- not EMP
CHECKIDENT
(from: check identity) is just the name of the command for the DBCC
function in SQL Server (there are a lot more DBCC.......
commands available)
Upvotes: 2