February 4, 2009 at 3:25 am
Hi
How dow I convert this date AUG2007 to 200708.
Select Distinct Replace(Convert(Numeric, [Month], 112), '/', '') as Period
From PTX_TERMINATIONS
I tried this code and several other combinations but I'm not winning.
Please help
February 4, 2009 at 7:18 am
This is the way I would do it, but I am sure there are many more ways:
SELECT CONVERT(CHAR(6),CONVERT(SMALLDATETIME, GETDATE()), 112)
February 4, 2009 at 12:47 pm
[font="Verdana"]Mine would be:
selectconvert(varchar(6), getdate(), 112)
[/font]
February 4, 2009 at 4:03 pm
gary.proctor (2/4/2009)
This is the way I would do it, but I am sure there are many more ways:SELECT CONVERT(CHAR(6),CONVERT(SMALLDATETIME, GETDATE()), 112)
Bruce W Cassidy (2/4/2009)
[font="Verdana"]Mine would be:
selectconvert(varchar(6), getdate(), 112)
[/font]
The only thing is that thatok asked
thatok (2/4/2009)
How dow I convert this date AUG2007 to 200708.
So the key point I was making is that CONVERT will do the conversion without the need for a day number!
Derek
February 4, 2009 at 4:19 pm
[font="Verdana"]Okay. How about:
select convert(varchar(6), convert(datetime, 'AUG2007'), 112)
[/font]
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy