Convert Month Number to Month Name


declare @t table (num int)
insert into @t values (1)
insert into @t values (2)
insert into @t values (3)
insert into @t values (4)
insert into @t values (5)
insert into @t values (6)
insert into @t values (7)
insert into @t values (8)
insert into @t values (9)
insert into @t values (10)
insert into @t values (11)
insert into @t values (12)
insert into @t values (13)

SELECT DateName(month,Dateadd(month,num-1,0)) as MonthName
FROM @t

Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s