views:

17

answers:

2

Dear interested reader,

how do I format a date (smalldatetime) in Mai 2010 (i.e. 06.05.2010 => Mai 2010 or 06.10.2009 => October 2009)

thx a lot... greetings

+3  A: 
SELECT SUBSTRING(CONVERT(VARCHAR(20), GETDATE(), 107), 0, 4) + SUBSTRING(CONVERT(VARCHAR(20), GETDATE(), 107), 8, 5)

Changing GETDATE() with your column.

Ardman
thats it! thx to all for practical and theoratical help
A: 

You can use the CONVERT function to convert it to a string, the function can take an optional 3d parameter called style that takes an integer determining the formatting.

more info here

klennepette