A while back, I wrote a couple of tips about simulating
TRY_CONVERT
– a function added in SQL Server 2012 – in earlier versions (see Part 1 and Part 2). Recently, someone in the community had a similar requirement: they wanted to makeTRY_PARSE
work for dates in SQL Server 2008. Now, I’m not one to help people stay on versions of SQL Server that are now 15 years old, but I do acknowledge that hands may be tied, and they can’t always control the version they’re stuck with.
Aaron does this community member a solid, though it’s probably something you’d never want to use if you’re on SQL Server 2012 or later.