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.
| Author |
Topic |
|
prashanthpulgal
Starting Member
1 Post |
Posted - 2002-11-24 : 02:32:14
|
| Hi,Can any one tell me how to get the quarter to which the month belongs to in SQL Server 2000 using the month name.Using DATEPART(Qq,getdate()) it is possible but it is basec on date.HOw to get based on mont name |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-11-24 : 06:30:24
|
| SELECT CASE WHEN MonthName IN('January','February','March') THEN 1WHEN MonthName IN('April','May','June') THEN 2WHEN MonthName IN('July','August','September') THEN 3ELSE 4 END AS QuarterWhy are you only storing the month name instead of an actual date value?Edited by - robvolk on 11/24/2002 06:30:49 |
 |
|
|
ValterBorges
Master Smack Fu Yak Hacker
1429 Posts |
Posted - 2002-11-24 : 11:41:48
|
| SELECT DatePart(q,CAST((@strMonth + '01 01') As DateTime)) |
 |
|
|
|
|
|