James Barash
James at fcidms.com
Wed Aug 10 12:27:23 CDT 2005
Jim If you use Truncate Table to clear the table contents, that will reset the Identity back to the initial seed. You can also use DBCC CHECKIDENT(tablename, RESEED,1) to reset the Identity back to 1 or whatever value you need. Hope that helps. James Barash -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Wednesday, August 10, 2005 12:42 PM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] Building tables Hi All: I have been porting a legacy database into a new MS SQL set of tables. In the process the data is added and removed several times as improvements are made on the table structures and the DTS is tested. Each time the import process is re-ran the auto ID identity values, of course, continue to increment. The field can be re-set manually by changing the ID field type, clearing the table content and changing the field type back; all very labour intensive. Is there a simple way, in code, to initialize the auto ID identity values so it re-start at the initial seed value? MTIA Jim _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com