[dba-SQLServer] Building tables

David Mcafee dmcafee at pacbell.net
Wed Aug 10 12:44:58 CDT 2005


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 



More information about the dba-SQLServer mailing list