Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 chronologically ordering of months

Author  Topic 

jryannel
Starting Member

13 Posts

Posted - 2004-05-03 : 20:17:05
The order by value works for alpha order on columns, but I have a column with month names and would like to order this chronologically just like any calendar. Are there any simple sql commands do this? I can't seem to figure it out..

Thanks, Jeff

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-05-03 : 20:19:36
So you have no other column that is of datetime data type? If you do, you can ORDER BY DATEPART(m, DatetimeColumnName).

Tara
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2004-05-03 : 21:58:12
order by case monthname when 'January' then 1 when 'February' then 2 when.... end
Maybe better to put the names and valuse into a table and join to that.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -