Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Reset Autonumber

Author  Topic 

Pinto
Aged Yak Warrior

590 Posts

Posted - 2005-04-06 : 08:48:46
I will be importing approx 96,000 records from an Access table into a sql table. I am making an autonumber the key of the sql table and will store the old Access autonumber in a separate field. If my last Acces number is say 96100 is there any way once the records are imported to start the next sql autonumber off at 96100.

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2005-04-06 : 08:51:42
Wouldn't you want your next number to be 96101???

You can use:

DBCC CHECKIDENT(tablename,RESEED,96099)
--You reset it to one number less than the next number you want to be entered.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

JimL
SQL Slinging Yak Ranger

1537 Posts

Posted - 2005-04-06 : 08:53:09

Pre-set your IDENTITY field to 96101

by Derrick

Jim
Users <> Logic
Go to Top of Page

Pinto
Aged Yak Warrior

590 Posts

Posted - 2005-04-06 : 08:55:24
Thanks for your help. The thing is my last Access Id may be 96100, but numbers may have been deleted or discarded so there may be only 96050 records, the last id being 96100. If I just used ther autonumber of the sql table it would generate 96051 whcih would/could already have been used. I can use your code to generate the next number I want though.
Go to Top of Page
   

- Advertisement -