SQL Server Msg 242: The conversion of a varchar data type to a datetime data type resulted in an out-of-range value
A date string couldn't be converted because it's invalid or in the wrong format for the session language.
The conversion of a varchar data type to a datetime data type resulted in an out-of-range valueout-of-range value datetime SQL ServerSqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999datetime out of range Meaning
Use ISO YYYYMMDD or YYYY-MM-DDTHH:MM:SS, parameterise dates as datetime2, and avoid depending on SET DATEFORMAT/language. datetime ranges from 1753; datetime2 from 0001.
Common causes
- dd/mm/yyyy read as mm/dd/yyyy
- Invalid date such as 31 April
- Date before 1753 for datetime
- Empty string converted to date
- Wrong DATEFORMAT/language
⚡ Quick fix
- Use ISO 8601 /
YYYYMMDDliterals - Use
datetime2and typed parameters - Validate with
TRY_CONVERT
Detailed fix by platform
SQL
SELECT TRY_CONVERT(datetime2, '2026-13-45') AS ok_or_null;
How to diagnose
- Format — ISO?
- Type — datetime2?
- Value — Valid date?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in SQL
Other ways to find it
Where this error sits
Origin: Data. Errors that are often confused with or caused by this one (click to open):
🧠 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.
Report a correction or suggest an improvement
Last updated 18 Nov 2026