245 SQL Origin: Data OSI layer 7 · Application Last updated 14 Oct 2026

SQL Server: Conversion failed when converting the varchar value 'x' to data type int. (Msg 245)

SQL Server tried to convert text to a number (often implicitly) and hit a non-numeric value.

Exact message you may see Conversion failed when convertingConversion failed when converting date and/or time from character string
Seen on: SQL

Meaning

Comparing a varchar column with an int forces conversion of every row; one non-numeric value breaks the query. Data type precedence makes int win.

Common causes

  • Comparing varchar columns with numbers
  • Mixed data in a varchar column
  • String concatenation with + and numbers

⚡ Quick fix

  1. Compare like with like (quote the literal)
  2. Use TRY_CONVERT/TRY_CAST to skip bad values
  3. Concatenate with CONCAT()

Detailed fix by platform

SQL

  1. SELECT * FROM dbo.Items WHERE TRY_CONVERT(int, Code) = 42;

How to diagnose

  1. Value — Which value fails?
  2. Expression — Implicit conversion where?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Data. Errors that are often confused with or caused by this one (click to open):

100038 — Snowflake: Numeric value 'X' is not recognized (SQL)100038102 — SQL Server: Incorrect syntax near 'x'. (Msg 102) (SQL)10218456 — SQL Server: Login failed for user 'x'. (Error 18456) (SQL)18456201 — SQL Server Msg 201: Procedure or function expects parameter '@X', which was not supplied (SQL)201207 — SQL Server: Invalid column name 'x'. (Msg 207) (SQL)207208 — SQL Server: Invalid object name 'x'. (Msg 208) (SQL)20822P02 — ERROR: invalid input syntax for type integer: "abc" (PostgreSQL)22P02242 — SQL Server Msg 242: The conversion of a varchar data type to a datetime data type resulted in an out-of-range value (SQL)242245

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.