how to reset the id of a identity column ?

Posted by gondar | Filed under

when we are developing something, most of the time we insert dump data into some tables, and then some testes need to have fresh ids, for some reason, so, how we do that ?

example: reset the id of table product

DBCC CHECkIDENT (product, RESEED,0)

where 0 is the value that when incremented with the value selected (usually is 1) will give the id for the first row inserted, in this case will be 1 (0 + 1)

hope it helps