How do I convert a date to the following format? MM_YYYY
with an underscore instead of forward slashes or full stops?
I want to change this query to underscores:
SELECT RIGHT(CONVERT(VARCHAR(10), GETDATE(), 105), 7) AS [MM-YYYY]
Thanks,
Jenny
Use your very same command with a replace:
SELECT replace(RIGHT(CONVERT(VARCHAR(10), GETDATE(), 105), 7),'-','_')
See it here at fiddle: http://sqlfiddle.com/#!3/d41d8/29554