Jim Lawrence
accessd at shaw.ca
Wed Aug 10 17:58:08 CDT 2005
Francis, James and David: Thanks very much for you help! Much appreciated. I will implement the code immediately and see how it works. Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of David Mcafee Sent: Wednesday, August 10, 2005 10:45 AM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] Building tables Jim, as James mentioned, I would use the TRUNCATE command in your DTS. The only thing is if you have relationships connecting to the table in question, you will have to drop them before the truncate and recreate them afterwards. --- James Barash <James at fcidms.com> wrote: > 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