sql server - Converting datetime to month-year only - T-SQL -


I want to change the date-time value in a month (note that (-) ).

I want them like January-2015, February 2014, March-2014, April 2014.

I have tried

  SELECT Convert (varchar (7), getdate (), 126) select correct (convert (varchar, getdate (), 106) , 8)  

But the first line gives me the 2014-05 (I need it like May-2014), while the second line is missing as it is in May 2014 (May-2014 )

You were almost there:

  select replace (Right (convert, getdate (), 106), 8), '', '-')  

Comments

Popular posts from this blog

jsp - No mapping found for HTTP request with URI with annotation config Spring MVC and Jetty -

java - Ajax call to jsp and jsp redirecting to further jsp -

c# - Roxy file manager in MVC doesn't accept session path -