How to know month name from month index in t-sql

added by praveenbattula
10/16/2010 8:56:33 AM

0 Kicks, 74 Views

When I am working with reports, this is what every time I am looking for. Everyone gives date on the report as input, and I want display the month name on the report instead of month index [1-12]. So, how to do it? please use the below script to get the name of the month by month index. DateName(month, convert( datetime, '2007-' + cast(month(getdate()) as varchar(2)) + '-01', 120)) Here month(getdate()) returns the current month index from getdate() function. Hope this helps...


0 comments