SQLCODE -181
SQL0181 Value in date, time or timestamp out of range
- IBM message text
- Value in date, time, or timestamp string not valid.
- SQLCODE
- -181
- SQLSTATE
- 22007
Most common cause
The string has the right format but the date does not exist: '2026-02-30', '0000-00-00'. Classic when converting numeric dates holding zeros or 99999999.
Other causes
- Two-digit-year formats (*MDY, *YMD, *DMY, *JUL) with dates outside 1940-2039.
How to fix it
Filter out conventional values with a CASE before converting (CASE WHEN datefield = 0 THEN NULL ...). Fix the data at the source when you can.
Related errors
Text and codes from IBM documentation for 7.6. Checked on .