Monday, March 19, 2012

bulk insert in the exact sequence as the text file

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 i
n
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?How do you know that table is not loaded in sequence from your text file? A
table is an unordered set of rows so you must specify ORDER BY when
selecting from the table in order to guarantee sequence.
Hope this helps.
Dan Guzman
SQL Server MVP
"eieed" <eieed@.discussions.microsoft.com> wrote in message
news:5A497B7A-E3EC-4C30-B1A4-D13C0E23DEA1@.microsoft.com...
> 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?

No comments:

Post a Comment