I interpret your question in two ways.
a) You only need a month and a year separately, in which case here is the answer
select [YEAR] = YEAR(getdate()) ,[YEAR] = DATEPART(YY,getdate()) , [MONTH] = month(getdate()) ,[MONTH] = DATEPART(mm,getdate()) ,[MONTH NAME] = DATENAME(mm, getdate())
b)
You want to display from the specified date, say '2009-11-24 09:01:55.483' in MONTH.YEAR format. Thus, the output should look like 11.2009 in this case.
If it should be, try this (among other alternatives)
select [Month.Year] = STUFF(CONVERT(varchar(10), GETDATE(),104),1,3,'')
priyanka.sarkar Nov 24 '09 at 3:38 2009-11-24 03:38
source share