Just wondering if anyone can help me format a Year/Month INT column in the format YYYYMM to a user friendly date with short month e.g.Jan, Feb rather than a number.
A couple of examples:
201101 to Jan 2011
201312 to Dec 2013
I can substring out the components no worries, I just can't work out how to turn 01 to Jan.
EDIT:
Based on @Karl's answer this it what I have come up - it's pretty ugly but it works:
DECLARE @Test INT
SET @Test = 201206
SELECT SUBSTRING(DATENAME(month, DATEADD(month, CAST(SUBSTRING(CAST(@TEST AS VARCHAR), 5, 2) AS INT) - 1 , CAST('2008-01-01' AS datetime))),1,3) + ' ' + SUBSTRING(CAST(@Test AS VARCHAR),1,4) as Test