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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RESEED in order

Status
Not open for further replies.

ddeegan

Programmer
Jun 17, 2002
193
US
Hello

I am doing a data migration project from SQL to SQL

The new table has an identity column that must be started with a specific value.

Using identity(int,1,1) and DBCC CHECKIDENT(TableName, RESEED, @mynewid), I can populate the table - BUT

Is there a way that I can control the order that the identity column is populated?

The old table has a field called "LINE_NO" that keeps the records in chronological order - but it doesn't match the order of the new identity column ( the column created with identity() ).

Doing this in the interface is another set of headaches so I was hoping I could store the data in a certain order. (The data will be read only) The interface displays it in the order of the identity column. But I can't seem to figure out how to set the order of the identity column.

Thanks
Dave
 
mmmmm
8 CPU machine
mismatch 0
plan is below
Code:
  |--Table Insert(OBJECT:([blah2]), SET:([blah2].[id]=[Expr1003], [blah2].[oldid]=[blah].[oldid]))
       |--Top(ROWCOUNT est 0)
            |--Compute Scalar(DEFINE:([Expr1003]=setidentity([Expr1002], -7, 0, 'blah2')))
                 |--Compute Scalar(DEFINE:([Expr1002]=getidentity(-7, 0, 'blah2')))
                      |--Parallelism(Gather Streams, ORDER BY:([blah].[oldid] ASC))
                           |--Sort(ORDER BY:([blah].[oldid] ASC))
                                |--Table Scan(OBJECT:([DJIData6].[dbo].[blah]))

Denis The SQL Menace
SQL blog:
Personal Blog:
 
For some reason my exec plan is slightly different.
Btw. @@version is:

Microsoft SQL Server 2000 - 8.00.2039 (Intel X86) May 3 2005 23:18:38 (Build 2195: Service Pack 4).

There are no weirdos in settings, even NT fibers are turned off.

------
[small]select stuff(stuff(replicate('<P> <B> ', 14), 109, 0, '<.'), 112, 0, '/')[/small]
[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top