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 |
|
kshitizgp
Starting Member
31 Posts |
Posted - 2012-02-21 : 10:49:50
|
| select Name,Block_Name,BlockType, HOURS , Month,cast((DP.Hours*PH.pp)as decimal(4,0))as tt1,PH.PP,case Month when 'january' then 1 when 'february' then 2 when 'march' then 3 when 'april' then 4 when 'may' then 5 when 'june' then 6 when 'july' then 7 when 'august' then 8 when 'september' then 9 when 'october' then 10 when 'november' then 11 when 'december' then 12 end as mnthfrom ##temp1 DP, ##cmd_holiday PH where DP.MOnth = PH.MOnthsthis query is giving me months compare i wanna compare year also over here ..can u temme how i can do this ...am not so good wid date functions |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-02-21 : 13:44:47
|
| why do you need to generate month numbers like this? why not apply datepart(mm,datefield) to get month value for dates?for comparing year use datepart(yy,datefield)------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|