Msg 245, Level 16, State 1, Line 1
Conversion failed when converting the %ls value ‘%.*ls’ to data type %ls.
This error message appears, when SQL Server encounters an error while converting from one type into another type.
The T-SQL statement can be parsed, but causes the error at runtime.
Error of the Severity Level 16 are generated by the user and can be fixed by the SQL Server user. The rules for converting (implicit and explicit) data types and the rules for data type precedences must be followed.
All versions of SQL Server.
SELECT ‘20070217 00:00:00’ + 12
In the above example we try to combine a string and an integer value. Because of the higher data type precedence of integer values over string values, SQL Server tries to convert the string value into a value of type integer. This raises the error. This example uses implicit conversion and is a frequent error when dynamic SQL is used. But even when explicit conversion is used this is a frequent error.