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
 Import/Export (DTS) and Replication (2000)
 bulk insert in exact sequence

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-03-09 : 08:10:59
Ed writes "I'm having an issue when doing a bulk insert on a SQL 2000 server. I need the table rows to load in the exact order that the rows in the text file are sequenced.

So far, the bulk insert appears to be loading the file in 2 different orders. One of the orders is the same order as the text file. The other order is completely different and does not appear to have any reason to be in the different order.

I've tried setting the BATCHSIZE argument to 1 and that doesn't fix it. Using the ORDER argument doesn't help either because the destination table doesn't have a primary key plus I don't want to change the order of the text file anyways.

Is there a way to ensure the BULK INSERT loads the file in the exact order that the text file is in?"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-03-09 : 08:13:51
Why exactly does the order need to be maintained? Once they go into a table their physical order becomes meaningless. You cannot retrieve them in any particular order unless you use an ORDER BY clause.
Go to Top of Page

srirup
Starting Member

2 Posts

Posted - 2006-02-08 : 06:59:00
Iam also facing the same problem.

i also need the data in the same order in the table present in the text file and i have a particular reason for it i.e

in my text file there are set of rows in a particular sequence which gets inserted into a particular row of a table based on some criteria.
and then again there a new set of rows just below it.

now if the order is changed after doing a bulk insert , then data will be inserted in wrong tables.

so kindly tell me if there is a way to retain the same order in the table as is in the text file.
Go to Top of Page

srirup
Starting Member

2 Posts

Posted - 2006-02-08 : 07:06:53
after doing a bulk insert, i need the data in the same order in the table as it is present in the text file and i have a particular reason for it i.e

in my text file there are set of rows in a particular sequence which gets inserted into a particular row of a table based on some criteria.
and then again there a new set of rows just below it.

now if the order is changed in the table after doing a bulk insert , then data will be inserted in wrong tables.

so kindly tell me if there is a way to retain the same order in the table as it is in the text file.
Go to Top of Page
   

- Advertisement -