purushotham.k9
SSCommitted
Points: 1992
More actions
December 9, 2009 at 2:27 am
#137424
I need a help to convert string value into dateformat. like i have a string like '2009-NOV' i want to retrive month after converting dateformat...
ss-457805
SSCertifiable
Points: 5872
December 9, 2009 at 2:51 am
#1089700
declare @i varchar(25)
set @i='2009-NOV'
select datename(month,cast(@i as datetime))
Nabha
SSCrazy Eights
Points: 8534
December 9, 2009 at 2:53 am
#1089701
or this?
Declare @string varchar(20)
SET @string = '2009-Nov-11'
SELECT datepart(m,CONVERT(datetime, @string))
---------------------------------------------------------------------------------
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply