Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Migrating data from old database to new one

Status
Not open for further replies.

ausmoran

MIS
Apr 8, 2001
157
US
I'm not sure I'm in the correct forum, but hopefully someone will be able to offer some help here!

I am attempting to move data from an old SQL2000 database to a new SQL2000 database. The new database has some additional tables, I've added a few fields to some of the tables that were present in the old database, and some of the old tables are unchanged.

In testing out the .NET application that is built on top of the new database, I've added a number of test records. Here is my primary question:

1. When I move the old data to the new database, I need to ensure that all of the IDs remain the same, is there a way to reset all of the Identity fields in the new database so that they start counting from "1" again?

Thanks in advance for any assistance you might be able to offer.

- Austin
 
>> is there a way to reset all of the Identity fields in the new database so that they start counting from "1" again?

2 ways

truncate table (this is not always possible if you have relation ships)
or
DBCC CHECKIDENT (<TableName>, RESEED, 1)


Denis The SQL Menace
SQL blog:
Personal Blog:
 
Thanks very much for your speedy response. This is a big help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top