Medium severitydata format
Power BI Refresh Error:
22P02
What does this error mean?
A text value could not be converted to the target data type — e.g., trying to cast 'abc' to INTEGER.
Common causes
- 1ETL pipeline passes string values to a typed column without validation
- 2CSV or JSON source data has type mismatches (e.g., empty strings instead of NULL for numeric columns)
- 3Schema drift — source column type changed from string to number
How to fix it
- 1Step 1: Identify the failing column and value from the error message.
- 2Step 2: Add type validation or NULLIF transformation in the ETL pipeline.
- 3Step 3: Use `TRY_CAST` equivalent: `CASE WHEN value ~ '^[0-9]+$' THEN value::INTEGER ELSE NULL END`.
- 4Step 4: Review source schema for recent type changes that may have broken the pipeline.
Frequently asked questions
Official documentation: https://www.postgresql.org/docs/current/errcodes-appendix.html