I've been working with a SQL 2000 test database extensively and am about
ready to move the database from development to production. I'm going to
delete all of the test data that has built up. What I'd like to do is to be
able to reset the various indexes within the tables so that they start again
from 1 or whatever the first seed number would be for the index. Is there a
way to do this other than remove the seed from each table, save the table,
and then set up the seed again?
ThanksYou could try this... I haven't tried it or even looked at the code so I
take no responsibility if it doesn't work or breaks something :)
http://www.sqlservercentral.com/scripts/contributions/507.asp
"D Long" <msnewsaspen.5.dlong@.spamgourmet.com> wrote in message
news:#TN3wdvnDHA.2732@.TK2MSFTNGP11.phx.gbl...
> I've been working with a SQL 2000 test database extensively and am about
> ready to move the database from development to production. I'm going to
> delete all of the test data that has built up. What I'd like to do is to
be
> able to reset the various indexes within the tables so that they start
again
> from 1 or whatever the first seed number would be for the index. Is there
a
> way to do this other than remove the seed from each table, save the table,
> and then set up the seed again?
> Thanks
>|||Indexes don't have "seeds". They are made up from the data in the column(s)
that the index expression is on. If you remove all the data then there is
nothing in the index. If your talking about an column in the table that has
an IDENTITY property you can issue DBCC CHECKIDENT to reseed the next value.
If your removing ALL the rows you can also use TRUNCATE TABLE which not only
deletes all the data in a snap but resets the IDENTITY value as well.
--
Andrew J. Kelly
SQL Server MVP
"D Long" <msnewsaspen.5.dlong@.spamgourmet.com> wrote in message
news:%23TN3wdvnDHA.2732@.TK2MSFTNGP11.phx.gbl...
> I've been working with a SQL 2000 test database extensively and am about
> ready to move the database from development to production. I'm going to
> delete all of the test data that has built up. What I'd like to do is to
be
> able to reset the various indexes within the tables so that they start
again
> from 1 or whatever the first seed number would be for the index. Is there
a
> way to do this other than remove the seed from each table, save the table,
> and then set up the seed again?
> Thanks
>
Wednesday, March 21, 2012
Re-seeding Indexes
Labels:
database,
extensively,
indexes,
microsoft,
mysql,
oracle,
production,
re-seeding,
server,
sql,
working
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment