SELECT MONTH([date field])
WHEN 1 THEN 'Jan' WHEN 2 THEN 'Feb' WHEN 3 THEN 'Mar'
WHEN 4 THEN 'Apr' WHEN 5 THEN 'May' WHEN 6 THEN 'June'
WHEN 7 THEN 'July' WHEN 8 THEN 'Aug' WHEN 9 THEN 'Sep'
WHEN 10 THEN 'Oct' WHEN 11 THEN 'Nov' WHEN 12 THEN 'Dec' END
Source: SQL Server Calendar Table
select
datename(month, datefield) as month, count (employee) cnt
from
tablename
where
paygrp = 'mycriteria'
group by
datename(month, datefield)
select
month(datefield) as month, datename(month, datefield) as monthname, count (employee) cnt
from
tablename
where
paygrp = 'mycriteria'
group by
month(datefield), datename(month, datefield)
order by
month(datefield)
SELECT DATENAME(month, DATEADD(month, @mydate-1, CAST('2008-01-01' AS datetime)))