I have a varchar string e.g. '20110118200736' stored in a database column. This is a string representation of YYYYmmddHHMMSS. I'm not sure why the table designer made this a string instead of a datetime, but that's what I have to work with.
Is there a simple way to convert this to a datetime without parsing the whole darn thing? simply assigning it to a datetime doesn't work. convert(datetime,stringval) doesn't work. I can get the date component using datetimeVal = left(stringval,8), but that leaves me to parse the time component.
Microsoft SQL Server 2005
8/22/2022 - Mon
Your help has saved me hundreds of hours of internet surfing.