While running the following code on a database on my SQL Server 2012 instance I got the following error message
USE BB go SELECT TRY_CONVERT(xml, 'MyClub')
The reason for this error is that this function TRY_CONVERT is 110 compatible. Which means it will only run on a database with 110 compatibility. Upon checking the compatibility level, I found the database to be on 90 or SQL Server 2005 compatible.
Resolution:
I had to change the compatibility level to 110 and then ran the code with success.
Tagged: Analytical functions in SQL Server 2012, Error message, Functions, Microsoft SQL Server, New features in SQL Server 2012, Troubleshooting, TRY_CONVERT
Leave a Reply