I'm trying to sequence the Months as Jan, Feb,March etc.
If I use Order By I'm getting April,Dec,Feb etc sorted alphabetically.
Is there a solution to sort them as Jan,Feb,March,April etc?
Yes. If you are using SQL Server
ORDER BY
CASE yourmonth
WHEN 'January' THEN 1
WHEN 'February' THEN 2
WHEN 'March' THEN 3
:
WHEN 'December' THEN 12
END
Re: Performance issue with row size and order by ... You are probably observing in-memory sort versus on-disk sort.... The amount of memory sort uses is dynamically tuned. ...SQL Server Storage Engine Development... (microsoft.public.sqlserver.server)
Re: How top actually works ... So the next one shows that order by clause has affected the result set ...sort these N rows according to my order by clause. ... Ie. you are telling SQL Server... This is much the same as with rownum in Oracle,... (comp.databases.ms-sqlserver)
Re: Establishing Precedence In ORDERBY Condition Causing Problems. ... That query looks very much like the SELECT in the procedure you ... The ORDER BY CASE @sort is supposed to only tell SQL to return data ... far as I can call you have <bigquery> thrice in your procedure: ... I was SQL Server 2000 when I wrote this SPROC but we have since ... (comp.databases.ms-sqlserver)
Re: index versus order by question ... How does sql server then sort the table? ... The table in quesion is still sorted accoring to the clustered index.... I suggest you check out the "Physical Database Architecture" section in Books Online. ... (microsoft.public.sqlserver.setup)