<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; ORDER BY ColumnName vs ORDER BY ColumnNumber</title>
	<atom:link href="http://blog.sqlauthority.com/2010/12/27/sql-server-order-by-columnname-vs-order-by-columnnumber/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2010/12/27/sql-server-order-by-columnname-vs-order-by-columnnumber/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Sat, 25 May 2013 01:31:40 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #009 &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2010/12/27/sql-server-order-by-columnname-vs-order-by-columnnumber/#comment-400684</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #009 &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Sat, 29 Dec 2012 01:31:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=11361#comment-400684</guid>
		<description><![CDATA[[...] ORDER BY ColumnName vs ORDER BY ColumnNumber [...]]]></description>
		<content:encoded><![CDATA[<p>[...] ORDER BY ColumnName vs ORDER BY ColumnNumber [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sachin</title>
		<link>http://blog.sqlauthority.com/2010/12/27/sql-server-order-by-columnname-vs-order-by-columnnumber/#comment-364021</link>
		<dc:creator><![CDATA[Sachin]]></dc:creator>
		<pubDate>Thu, 25 Oct 2012 04:04:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=11361#comment-364021</guid>
		<description><![CDATA[How to Avoid Order by Completely . Example 
I have a query 

select datakey from V_Definitions
where DataKey in (
&#039;FLASH1ZZZZ&#039;,
&#039;042I01OAMJDA&#039;,
&#039;035CY40IMJ&#039;,&#039;034C0ZD1MJ&#039;) and Site = &#039;PJ&#039; and System = &#039;GO&#039;

and I want the output in the same order od the datakey that i have provided in the &quot;in&quot;.

Output received from query
034C0ZD1MJ                      
035CY40IMJ                      
042I01OAMJDA                    
FLASH1ZZZZ                      

Expected Ouput                 
FLASH1ZZZZ
042I01OAMJDA
035CY40IMJ
034C0ZD1MJ

how can a default sort of ASC be avoided ?]]></description>
		<content:encoded><![CDATA[<p>How to Avoid Order by Completely . Example<br />
I have a query </p>
<p>select datakey from V_Definitions<br />
where DataKey in (<br />
&#8216;FLASH1ZZZZ&#8217;,<br />
&#8217;042I01OAMJDA&#8217;,<br />
&#8217;035CY40IMJ&#8217;,&#8217;034C0ZD1MJ&#8217;) and Site = &#8216;PJ&#8217; and System = &#8216;GO&#8217;</p>
<p>and I want the output in the same order od the datakey that i have provided in the &#8220;in&#8221;.</p>
<p>Output received from query<br />
034C0ZD1MJ<br />
035CY40IMJ<br />
042I01OAMJDA<br />
FLASH1ZZZZ                      </p>
<p>Expected Ouput<br />
FLASH1ZZZZ<br />
042I01OAMJDA<br />
035CY40IMJ<br />
034C0ZD1MJ</p>
<p>how can a default sort of ASC be avoided ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jack</title>
		<link>http://blog.sqlauthority.com/2010/12/27/sql-server-order-by-columnname-vs-order-by-columnnumber/#comment-110528</link>
		<dc:creator><![CDATA[Jack]]></dc:creator>
		<pubDate>Tue, 11 Jan 2011 21:49:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=11361#comment-110528</guid>
		<description><![CDATA[Agree entirely with Pinal - if you go back to the code three months later, no way will you remember what order by 3,2 is supposed to mean.  Is it right?  Is it wrong?  There is no way to tell.]]></description>
		<content:encoded><![CDATA[<p>Agree entirely with Pinal &#8211; if you go back to the code three months later, no way will you remember what order by 3,2 is supposed to mean.  Is it right?  Is it wrong?  There is no way to tell.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pinaldave</title>
		<link>http://blog.sqlauthority.com/2010/12/27/sql-server-order-by-columnname-vs-order-by-columnnumber/#comment-109071</link>
		<dc:creator><![CDATA[pinaldave]]></dc:creator>
		<pubDate>Sat, 01 Jan 2011 10:31:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=11361#comment-109071</guid>
		<description><![CDATA[If you want to compare both of them then you need to compare following

dbcc freeproccache
GO
SELECT DepartmentID,GroupName, Name, ModifiedDate
FROM HumanResources.Department
ORDER BY 3,2

GO

dbcc freeproccache
GO
SELECT DepartmentID,GroupName, Name, ModifiedDate
FROM HumanResources.Department
ORDER BY  Name, GroupName]]></description>
		<content:encoded><![CDATA[<p>If you want to compare both of them then you need to compare following</p>
<p>dbcc freeproccache<br />
GO<br />
SELECT DepartmentID,GroupName, Name, ModifiedDate<br />
FROM HumanResources.Department<br />
ORDER BY 3,2</p>
<p>GO</p>
<p>dbcc freeproccache<br />
GO<br />
SELECT DepartmentID,GroupName, Name, ModifiedDate<br />
FROM HumanResources.Department<br />
ORDER BY  Name, GroupName</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Judep</title>
		<link>http://blog.sqlauthority.com/2010/12/27/sql-server-order-by-columnname-vs-order-by-columnnumber/#comment-109069</link>
		<dc:creator><![CDATA[Judep]]></dc:creator>
		<pubDate>Sat, 01 Jan 2011 10:23:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=11361#comment-109069</guid>
		<description><![CDATA[Under the same circumstance, if column numbers are used then there is a significant number of logical reads vs the column names]]></description>
		<content:encoded><![CDATA[<p>Under the same circumstance, if column numbers are used then there is a significant number of logical reads vs the column names</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Judep</title>
		<link>http://blog.sqlauthority.com/2010/12/27/sql-server-order-by-columnname-vs-order-by-columnnumber/#comment-109068</link>
		<dc:creator><![CDATA[Judep]]></dc:creator>
		<pubDate>Sat, 01 Jan 2011 10:18:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=11361#comment-109068</guid>
		<description><![CDATA[Just checked this out and noticed the execution plans are deferent

dbcc freeproccache 
GO
SELECT DepartmentID,GroupName, Name, ModifiedDate
FROM HumanResources.Department
ORDER BY 3,2

GO

dbcc freeproccache 
GO
SELECT DepartmentID,GroupName, Name, ModifiedDate
FROM HumanResources.Department
ORDER BY GroupName, Name]]></description>
		<content:encoded><![CDATA[<p>Just checked this out and noticed the execution plans are deferent</p>
<p>dbcc freeproccache<br />
GO<br />
SELECT DepartmentID,GroupName, Name, ModifiedDate<br />
FROM HumanResources.Department<br />
ORDER BY 3,2</p>
<p>GO</p>
<p>dbcc freeproccache<br />
GO<br />
SELECT DepartmentID,GroupName, Name, ModifiedDate<br />
FROM HumanResources.Department<br />
ORDER BY GroupName, Name</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2010/12/27/sql-server-order-by-columnname-vs-order-by-columnnumber/#comment-108860</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Fri, 31 Dec 2010 10:28:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=11361#comment-108860</guid>
		<description><![CDATA[It is safe as long as no other columns are specified in that posistion in SELECT statement]]></description>
		<content:encoded><![CDATA[<p>It is safe as long as no other columns are specified in that posistion in SELECT statement</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tof</title>
		<link>http://blog.sqlauthority.com/2010/12/27/sql-server-order-by-columnname-vs-order-by-columnnumber/#comment-108747</link>
		<dc:creator><![CDATA[Tof]]></dc:creator>
		<pubDate>Fri, 31 Dec 2010 00:28:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=11361#comment-108747</guid>
		<description><![CDATA[Hi Pinal,

while I agree with you, number ordering very useful in a development environment and makes developers more productive.

I often use it when the select list holds a long subquery that I need to order by in SQL 2000. It saves me copying and pasting the whole thing in the order by clause, which makes the query look messy.]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>while I agree with you, number ordering very useful in a development environment and makes developers more productive.</p>
<p>I often use it when the select list holds a long subquery that I need to order by in SQL 2000. It saves me copying and pasting the whole thing in the order by clause, which makes the query look messy.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brad Schulz</title>
		<link>http://blog.sqlauthority.com/2010/12/27/sql-server-order-by-columnname-vs-order-by-columnnumber/#comment-108407</link>
		<dc:creator><![CDATA[Brad Schulz]]></dc:creator>
		<pubDate>Tue, 28 Dec 2010 22:58:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=11361#comment-108407</guid>
		<description><![CDATA[Hi Pinal...

I don&#039;t know if you read this blog post or not, but this is an amusing article I wrote on this subject, talking about the ORDER BY clause and using column aliases vs ordinal numbers vs functions:

http://bradsruminations.blogspot.com/2010/01/trolls-puzzle-sql-fable.html

--Brad]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal&#8230;</p>
<p>I don&#8217;t know if you read this blog post or not, but this is an amusing article I wrote on this subject, talking about the ORDER BY clause and using column aliases vs ordinal numbers vs functions:</p>
<p><a href="http://bradsruminations.blogspot.com/2010/01/trolls-puzzle-sql-fable.html" rel="nofollow">http://bradsruminations.blogspot.com/2010/01/trolls-puzzle-sql-fable.html</a></p>
<p>&#8211;Brad</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wallace Wells</title>
		<link>http://blog.sqlauthority.com/2010/12/27/sql-server-order-by-columnname-vs-order-by-columnnumber/#comment-108214</link>
		<dc:creator><![CDATA[Wallace Wells]]></dc:creator>
		<pubDate>Mon, 27 Dec 2010 18:36:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=11361#comment-108214</guid>
		<description><![CDATA[Hi Pinal! 
With my usual pleasure and laugh have I read another brilliant article of yours on Advanced SQL Server approaches. As usual you expect people to understand your point based on Experience and Knowledge level comparable to yours. These are not abundant around though.. So guys are just trying to understand say which column would you use for ordering in a query run against table with 20 million rows. But to understand it you have to first know how to assign Primary Key, which column to put Clustered Index on and by what reasons. Only then you will begin to understand and enjoy Pinal Daves blog! Otherwise, according to some comments, it is kind of complex. Thank you for teaching us! Keep up the excellent job! Have a happy and joyfull Holidays!]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal!<br />
With my usual pleasure and laugh have I read another brilliant article of yours on Advanced SQL Server approaches. As usual you expect people to understand your point based on Experience and Knowledge level comparable to yours. These are not abundant around though.. So guys are just trying to understand say which column would you use for ordering in a query run against table with 20 million rows. But to understand it you have to first know how to assign Primary Key, which column to put Clustered Index on and by what reasons. Only then you will begin to understand and enjoy Pinal Daves blog! Otherwise, according to some comments, it is kind of complex. Thank you for teaching us! Keep up the excellent job! Have a happy and joyfull Holidays!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ramdas</title>
		<link>http://blog.sqlauthority.com/2010/12/27/sql-server-order-by-columnname-vs-order-by-columnnumber/#comment-108192</link>
		<dc:creator><![CDATA[Ramdas]]></dc:creator>
		<pubDate>Mon, 27 Dec 2010 15:57:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=11361#comment-108192</guid>
		<description><![CDATA[Nice post to bring out the differences between ordering by column name and column number. For me it has been by col name majority of the times.]]></description>
		<content:encoded><![CDATA[<p>Nice post to bring out the differences between ordering by column name and column number. For me it has been by col name majority of the times.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2010/12/27/sql-server-order-by-columnname-vs-order-by-columnnumber/#comment-108176</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Mon, 27 Dec 2010 13:05:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=11361#comment-108176</guid>
		<description><![CDATA[It will work  that way. But the point is when you use column numbers in the order by clause, if some columns are added at the beginning of the select statement, it will be ordered differently. If you use column names in the order by clause, they wont be any problems]]></description>
		<content:encoded><![CDATA[<p>It will work  that way. But the point is when you use column numbers in the order by clause, if some columns are added at the beginning of the select statement, it will be ordered differently. If you use column names in the order by clause, they wont be any problems</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karthikeyan</title>
		<link>http://blog.sqlauthority.com/2010/12/27/sql-server-order-by-columnname-vs-order-by-columnnumber/#comment-108168</link>
		<dc:creator><![CDATA[Karthikeyan]]></dc:creator>
		<pubDate>Mon, 27 Dec 2010 11:56:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=11361#comment-108168</guid>
		<description><![CDATA[Pinal,

Hi, I am totally mess up with the example you have given. In the First query you Order the column by OrderName namely &quot;GroupName,Name&quot;. But when you are ordering by ColumnNumber inthe second query you ordered by &quot;ModifiedDate,Name&quot;i.e &quot;3,2&quot; refers to the Columns orders in the select statement not with the table ordering structure.Please try this and let me know.]]></description>
		<content:encoded><![CDATA[<p>Pinal,</p>
<p>Hi, I am totally mess up with the example you have given. In the First query you Order the column by OrderName namely &#8220;GroupName,Name&#8221;. But when you are ordering by ColumnNumber inthe second query you ordered by &#8220;ModifiedDate,Name&#8221;i.e &#8220;3,2&#8243; refers to the Columns orders in the select statement not with the table ordering structure.Please try this and let me know.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Madhivanan</title>
		<link>http://blog.sqlauthority.com/2010/12/27/sql-server-order-by-columnname-vs-order-by-columnnumber/#comment-108114</link>
		<dc:creator><![CDATA[Madhivanan]]></dc:creator>
		<pubDate>Mon, 27 Dec 2010 08:44:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=11361#comment-108114</guid>
		<description><![CDATA[You can use it in a dynamic sql where column names are unknown. Refer this post for more informations
http://beyondrelational.com/blogs/madhivanan/archive/2010/12/27/order-by-columnname-vs-order-by-columnnumber.aspx]]></description>
		<content:encoded><![CDATA[<p>You can use it in a dynamic sql where column names are unknown. Refer this post for more informations<br />
<a href="http://beyondrelational.com/blogs/madhivanan/archive/2010/12/27/order-by-columnname-vs-order-by-columnnumber.aspx" rel="nofollow">http://beyondrelational.com/blogs/madhivanan/archive/2010/12/27/order-by-columnname-vs-order-by-columnnumber.aspx</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: aasim abdullah</title>
		<link>http://blog.sqlauthority.com/2010/12/27/sql-server-order-by-columnname-vs-order-by-columnnumber/#comment-108097</link>
		<dc:creator><![CDATA[aasim abdullah]]></dc:creator>
		<pubDate>Mon, 27 Dec 2010 07:24:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=11361#comment-108097</guid>
		<description><![CDATA[Thanks Guru for correcting me.]]></description>
		<content:encoded><![CDATA[<p>Thanks Guru for correcting me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: amit</title>
		<link>http://blog.sqlauthority.com/2010/12/27/sql-server-order-by-columnname-vs-order-by-columnnumber/#comment-108085</link>
		<dc:creator><![CDATA[amit]]></dc:creator>
		<pubDate>Mon, 27 Dec 2010 06:04:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=11361#comment-108085</guid>
		<description><![CDATA[hi, can u put some more light on this topic. where exactly we can use ORDER BY ColumnNumber and its *not* possible to use ORDER BY ColumnName instead?]]></description>
		<content:encoded><![CDATA[<p>hi, can u put some more light on this topic. where exactly we can use ORDER BY ColumnNumber and its *not* possible to use ORDER BY ColumnName instead?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: amit</title>
		<link>http://blog.sqlauthority.com/2010/12/27/sql-server-order-by-columnname-vs-order-by-columnnumber/#comment-108084</link>
		<dc:creator><![CDATA[amit]]></dc:creator>
		<pubDate>Mon, 27 Dec 2010 06:04:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=11361#comment-108084</guid>
		<description><![CDATA[hi, can u put some more light on this topic. where exactly we can use  ORDER BY ColumnNumber and its possible to use ORDER BY ColumnName instead?]]></description>
		<content:encoded><![CDATA[<p>hi, can u put some more light on this topic. where exactly we can use  ORDER BY ColumnNumber and its possible to use ORDER BY ColumnName instead?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: G.Naresh Babu</title>
		<link>http://blog.sqlauthority.com/2010/12/27/sql-server-order-by-columnname-vs-order-by-columnnumber/#comment-108076</link>
		<dc:creator><![CDATA[G.Naresh Babu]]></dc:creator>
		<pubDate>Mon, 27 Dec 2010 04:28:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=11361#comment-108076</guid>
		<description><![CDATA[Hi u r Articles are too good can u send me the Information about &#039;Optimizing concurency with realtime Example&#039; .]]></description>
		<content:encoded><![CDATA[<p>Hi u r Articles are too good can u send me the Information about &#8216;Optimizing concurency with realtime Example&#8217; .</p>
]]></content:encoded>
	</item>
</channel>
</rss>
