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

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -