Row order | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Row order

I need import data from excel file. The problem – after import by dts rows are not order as in excel file. I tried many ways but result is different. Rows aren’t in order as in source file – always different and I need to keep the same order in the table as in the excel file, what can i do?? Thanks for the help!!!
Did you try to sort data in Excel?
Madhivanan Failing to plan is Planning to fail
Do you have any primary keys defined at the table I used DTS to transfer Orders table to excel file and it is transferred to excel file with the same order
First off all, i want transfer the excel file to a table. I cant’t sort data because the data is distribuited in a specific way that a i have to manage the data in the same way to know where is the speceific data that I want. A sample of excel file: Ordernumber1 orderdescription1
detailorder1 price1
detailorder2 price2
totalinletter total Ordernumber2 orderdescription2
detailorder1 price1
detailorder2 price2
totalinletter total thanks for the help

Did you try openRowset approach?
http://sql-server-performance.com/forum/topic.asp?TOPIC_ID=8440
Madhivanan Failing to plan is Planning to fail
I try openRowset and the same things happend. the first time that i try this the data pass in order, but the next time that i try the data don’t pass in order. And i have to do this every week and i need the data be in order.
quote:the first time that i try this the data pass in order, but the next time that i try the data don’t pass in order.
Next time, are you inserting the records to the same file by deleting the excel data?
Madhivanan Failing to plan is Planning to fail
I’m transfering a excel file to a table. The next time, I delete the table to transfer the excel file.
In the openRowset query, did you try to give order by
Insert into SQLServerTable Select * FROM OPENROWSET(‘Microsoft.Jet.OLEDB.4.0’,
‘Excel 8.0;Database=D: esting.xls;HDR=YES’,
‘SELECT * FROM [SheetName$] order by col’)
Madhivanan Failing to plan is Planning to fail
]]>