Friday, March 23, 2012

Order By Clause

Hello,
can any one tell me about the difference between the following queries.

1. SELECT * FROM Symp_User ORDER BY
2. SELECT * FROM Symp_User ORDER BY ASC

I don't think there is any difference in the above queries. kinldy make me clear on this.

thnkx,
rahul jhaServer: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'BY'.

I think you forgot to mention which field you want to order the result set by ;)

ASC/DESC are optional operators used in conjunction with the ORDER BY clause. If omitted ASC is assumed.|||sorry for the miss out. here is the actual query......

1. SELECT * FROM Symp_User ORDER BY LoginName
2. SELECT * FROM Symp_User ORDER BY LoginName ASC

My question is, whether will there be any Execution Plan difference for the above queries?

thnkx
rahul jha|||If omitted ASC is assumed.

See above :D|||thnkx george|||negated? don't you mean omitted?|||Yes, yes I do... :o
Posts edited|||My question is, don't you acces to SQL Server?

I mean it would be very easy to find out if you do, and if you don't, then download the dev version for free

No comments:

Post a Comment