A stupid third-party software that we use stores datetime as varchar for some good old reason and I need to parse it as sql datetime. Problem is, when the string is in mm/dd/yy format plain CAST() as datetiem works fine but my data is formatted as dd/mm/yy and CAST throws a
The conversion of a varchar data type to a datetime data type resulted
in an out-of-range value.
exception. Tips on doing it with CONVERT or CAST without using RIGHT()/LEFT() etc?
Thanks
One option would be to use SQL Server’s SET DATEFORMAT setting before performing the conversions. e.g.