﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2005 / T-SQL (SS2K5)  / Order by clause in openrowset / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Mon, 20 May 2013 07:47:27 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Order by clause in openrowset</title><link>http://www.sqlservercentral.com/Forums/Topic528101-338-1.aspx</link><description>SSCrazy is correct.  I was able to get around this, at least temporarily by using "distinct" after the select.  This might not always work.</description><pubDate>Fri, 07 Dec 2012 12:50:46 GMT</pubDate><dc:creator>ProgramAndPM</dc:creator></item><item><title>RE: Order by clause in openrowset</title><link>http://www.sqlservercentral.com/Forums/Topic528101-338-1.aspx</link><description>A table is an unordered set. Order is guaranteed only when the ORDER BY clause is used in the outer query and only in retrieval operations. If ORDER BY is not used the Optimizer is free to insert the rows into the table regardless of the way they have been ordered at the source.If you want to preserve a specific row order, you need to consider that at design time. You could, for instance, use an additional column to store the values you want to order the rows by - SQL Server cannot do that for you.When inserting data into an Excel Worksheet the easiest thing to do is to open the Workbook and sort the rows using Excel's sorting methods. YOu can even do that programmatically. Either way you won't be able to completely prevent Excel users from changing the order of the rows if they choose to do so.</description><pubDate>Fri, 25 Jul 2008 10:33:56 GMT</pubDate><dc:creator>Matija Lah</dc:creator></item><item><title>Order by clause in openrowset</title><link>http://www.sqlservercentral.com/Forums/Topic528101-338-1.aspx</link><description>hi INSERT INTO OPENROWSET ('Microsoft.Jet.OLEDB.4.0',                'Excel 8.0;Database=c:\test\Test.xls;',                'SELECT id,col1 FROM [Sheet1$]')    SELECT id,col1 FROM temp_test order by idEverything works fine....but the order by clause is not recoginsedwhen i use the query in analyser it works correctly with order by clause,but while xporting it is not working.Please help</description><pubDate>Thu, 03 Jul 2008 08:14:51 GMT</pubDate><dc:creator>vsjayashri</dc:creator></item></channel></rss>