8114: Error converting data type X to Y
SQL ServerWhat does it mean?
A value could not be converted from one data type to another because the types are incompatible. Unlike error 245, this is usually a failed type conversion at the parameter/expression level (e.g. varchar to numeric).
Why does it happen?
Sending non-numeric or malformed text to a numeric column/parameter; scale/precision overflow; trying to convert an empty string ('') to numeric; or passing an argument of the wrong type in a parameterized query. Common with implicit conversions generated by ORMs.
How to fix it
Verify that the converted values fit the target type. Use TRY_CONVERT / TRY_CAST for safe conversion; they return NULL on failure, so you can filter those rows with WHERE. Match parameter types to column types. Scan the data with ISNUMERIC/TRY_CAST to find offending rows, and clean up empty strings.
More from this engine
- 40544The database has reached its size quota (Azure SQL)
- 40613Database is not currently available (Azure SQL)
- 102Incorrect syntax near 'token'
- 1204The instance of the SQL Server Database Engine cannot obtain a LOCK resource
- 3906Failed to update database because the database is read-only
- 15023User already exists in the current database
- 18452Login failed. The login is from an untrusted domain and cannot be used with Windows authentication