Low severityschema
Power BI Refresh Error:
4902
What does this error mean?
An ALTER TABLE statement references a column, constraint, or index that does not exist in the table.
Common causes
- 1A migration script attempts to drop a column that was already removed in a previous migration
- 2A column name is misspelled in the ALTER TABLE statement
- 3The script targets the wrong table or schema
How to fix it
- 1Step 1: Check current table columns: SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'YourTable' ORDER BY ORDINAL_POSITION;
- 2Step 2: Use conditional ALTER: IF COL_LENGTH('dbo.YourTable', 'old_column') IS NOT NULL ALTER TABLE [dbo].[YourTable] DROP COLUMN [old_column];
- 3Step 3: Ensure the migration script runs in order and is not run twice — use a migration framework like Flyway or DbUp to track script execution.
Frequently asked questions
Official documentation: https://learn.microsoft.com/en-us/sql/relational-databases/errors-events/database-engine-events-and-errors