Suppose you need to delete all data from the table and reset IDENTITY count. We have 2 options. One goes for TRUNCATE TABLE that resets IDENTITY (altogether it wipes out all table data). The second goes to DBCC CHECKIDENT RESEED.
It is good that DBCC CHECKIDENT RESEED feature exists, but I use TRUNCATE TABLE. DBCC CHECKIDENT RESEED has one disadvantage: if there were rows in the table before deletion, it will give 1 for IDENTITY field after the next insert, else - 0, therefore it makes it counter-productive to use this construction in the build scripts.
Saturday, December 13, 2003 4:13 AM