June 17, 2010 at 12:22 pm
I would love a little help with converting the varchar to a datetime.
The varchar data is in the format YYYYMMDDHHMMSS
Andrew
June 17, 2010 at 12:35 pm
Well, I got the date in...
with SELECT Convert(VarChar(8), a.item)
June 17, 2010 at 12:40 pm
Unfortunately, it's a little more complicated, since SQL Server doesn't have a valid dateformat like the one you need to use as an input...
SELECT CAST(LEFT(@t,8) +' ' +SUBSTRING(@t,9,2)+':' +SUBSTRING(@t,11,2)+':' +SUBSTRING(@t,13,2) as DATETIME)
June 17, 2010 at 1:30 pm
Thanks...
We just got it as well. Although we used convert. Thanks for the response. I am always impressed on this forum.
Andrew
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply