Return Month Name From Date Or Number



declare @Mydt datetime 
set @mydt='2014-10-27'

select DATENAME(MM,@Mydt) Month_Name 

declare @num int=10

SELECT DateName(month,Dateadd(month,@num-1,0)) as Month_Name


--Another option:
DECLARE @num INT = 10
 
SELECT DATENAME(MONTH,@num*28) AS CurrentMonth
 
 
--http://www.sql-server-performance.com/2004/datetime-datatype/7/


 
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