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.
Author |
Topic |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-02-16 : 07:59:40
|
Srirup writes "after doing a bulk insert, i need the data in the same order in the table asit is present in the text file and i have a particular reason for it i.ein my text file there are set of rows in a particular sequence which getsinserted 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 , thendata will be inserted in wrong tables.so kindly tell me if there is a way to retain the same order in the table asit is in the text file." |
|
Kristen
Test
22859 Posts |
Posted - 2006-02-16 : 08:16:43
|
Best bet would be to add an Identity column which will be given a sequentially increasing number for each row inserted; then you can ORDER BY that new column when you want to present the data in the original order.Otherwise they is NO guarantee to the order that SQL presents the data - e.g. if you make a new query and SQL Server happens to have some of the data in memory, and has to get the rest from disk, then it will sequence the in-memory-data first, followed by the from-disk-data - but if you have an ORDER BY it will sequence it in that order, of course.Kristen |
 |
|
|
|
|