Hello Everyone
I have one table like t1.
Id,name,city ,pincode this kind of column have .Id has primary key its identity key its automatically increment.this table have 10 record.i was delete this 10 record.now i will enter new record that time its id 11 bcz its auto increment. now i want that after deleting all record of table If i insert new row that it id is 1.
so how reset indentity after deleting all record of table
Ravi PatelPosted Oct 26, 2015, 8:20 AM
DBCC CHECKIDENT can reseed (reset) the identity value of the table. For example, YourTable has 25 rows with 25 as last identity. If we want next record to have identity as 35 we need to run following T SQL script in Query Analyzer.
in your caseDBCC CHECKIDENT (yourtable, reseed, 34)DBCC CHECKIDENT (yourtable, reseed, 0)Priyaranjan K SPosted Oct 26, 2015, 7:45 AM
Francis SusaimichaelPosted Oct 26, 2015, 7:45 AM