June 26, 2003 at 9:56 am
THIS STATEMENT WORKS FINE BUT ON THE FINAL TABLE THE RECORDS ARE ALL OUT OF THE ORDER FROM THE ORIGINAL TXT FILE..SOMEBODY NOW WHY?
set @SQL ='BULK INSERT temp FROM ''' + @file1 + ''' WITH (FIELDTERMINATOR = ''\T'') '
June 30, 2003 at 8:00 am
This was removed by the editor as SPAM
June 30, 2003 at 2:35 pm
Is there an index forcing a sort on the data? That is the only thing that I can think of.
David
David
@SQLTentmaker“He is no fool who gives what he cannot keep to gain that which he cannot lose” - Jim Elliot
July 1, 2003 at 8:28 am
If your in coming data is sorted according to the index specified in the destination table you get will sorted data. If, however, the data file is sorted in different order or no order is specified records will inserted randomly.
July 1, 2003 at 8:53 am
There is no 'order of records' in a relational database. Even if SQL Server does apply some rules concerning the way in which the data is returned (in order of clustered key, I believe), you should not rely on this 'feature'.
Use a SORT clause in your query to return the records in the order you want them to be returned.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply