Oct 15, 2004 #1 room24 Programmer Dec 28, 2003 83 JM '1182004' @result_date has in the above string value i am trying to convert it using convert(datetime, @result_date) but i get this errror Syntax error converting datetime from character string.
'1182004' @result_date has in the above string value i am trying to convert it using convert(datetime, @result_date) but i get this errror Syntax error converting datetime from character string.
Oct 15, 2004 #2 vongrunt Programmer Mar 8, 2004 4,863 HR Is it Jan 18th 2004? or Aug 11th 2004? Place leading zero so that both day and month occupy 2 characters. CONVERT() also has 3rd optional parametar (date format style), though I'm not sure ddmmyy is supported. Upvote 0 Downvote
Is it Jan 18th 2004? or Aug 11th 2004? Place leading zero so that both day and month occupy 2 characters. CONVERT() also has 3rd optional parametar (date format style), though I'm not sure ddmmyy is supported.
Oct 15, 2004 #3 NoCoolHandle Programmer Apr 10, 2003 2,321 US You will need to do some string manipultaion to get this to work. declare @result_date varchar(100) set @result_date = '1182004' set @result_date = stuff(@result_date,4,0,'-') set @result_date = stuff(@result_date,2,0,'-') select CONVERT(DATETIME, @result_date) Upvote 0 Downvote
You will need to do some string manipultaion to get this to work. declare @result_date varchar(100) set @result_date = '1182004' set @result_date = stuff(@result_date,4,0,'-') set @result_date = stuff(@result_date,2,0,'-') select CONVERT(DATETIME, @result_date)