How to Fix “Conversion Failed When Converting” in SQL Server
By Sharon Ben-Moshe · August 8, 2026 · 2 min read
Sharon Ben-Moshe is the founder of sqlfmt, a browser-based SQL formatter and validator with misspelled-keyword suggestions across PostgreSQL, MySQL, SQLite, SQL Server, and BigQuery.
SQL Server's “Conversion failed when converting the varchar value … to data type int” (Msg 245) means a string in your data, or your query, doesn't actually look like the number or date you're trying to convert it to.
Quick answer
SQL Server Msg 245, “Conversion failed when converting the varchar value '...' to data type int,” fires when a value being implicitly or explicitly converted doesn't actually match the target type — commonly a non-numeric string compared to an int column, a badly formatted date, or one bad row hiding inside otherwise-valid data. TRY_CONVERT and TRY_CAST isolate the offending row without erroring.