Bradley Schacht is a Data Platform Solution Architect on the state and local government team with Microsoft based in Jacksonville, FL. He has co-authored 3 SQL Server books including "SQL Server 2014 Professional Admin". As a former consultant and trainer, he uses his experience on many parts of the Microsoft BI and data platform to help customers deliver the best possible solutions. Bradley frequently presents at community events around the country. He is a contributor to sites such as SQLServerCentral.com and an active member of the Jacksonville SQL Server User Group (JSSUG).
I’ll be honest, I am partially writing this because I always forget how to reset the identity column on a table and I want to be able to just pull up my blog and look it up. Yet again today I had to do this and I couldn’t remember the exact syntax, so here it is. The next record is going to be the seed value plus 1, or in the case of this example I will use zero so the first record is 1. That will make my O.C.D. happy to see my table starting with a key value of 1!
Hopefully this will help some people new to T-SQL and be a simple reminder for the veterans out there.
DBCC CHECKIDENT('TableNameHere', RESEED, StartingValue - 1)
DBCC CHECKIDENT('DimGeography', RESEED, 0)