Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

convert the string value into varchar Expand / Collapse
Author
Message
Posted Wednesday, December 9, 2009 2:27 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, December 8, 2010 7:22 AM
Points: 46, Visits: 107
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...
Post #831220
Posted Wednesday, December 9, 2009 2:51 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, July 16, 2014 4:07 AM
Points: 357, Visits: 1,682


declare @i varchar(25)
set @i='2009-NOV'
select datename(month,cast(@i as datetime))




blog: http://sarveshsingh.com

Twitter: @sarveshsing
Post #831234
Posted Wednesday, December 9, 2009 2:53 AM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Tuesday, August 2, 2011 3:36 AM
Points: 579, Visits: 1,803
or this?
Declare @string varchar(20)
SET @string = '2009-Nov-11'

SELECT datepart(m,CONVERT(datetime, @string))



---------------------------------------------------------------------------------
Post #831236
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse