metricsign
Start free
Medium severitydata integrity

Power BI Refresh Error:
8152

What does this error mean?

A value being inserted or updated is longer than the target column's defined length.

Common causes

  • 1Source column allows longer values than the target SQL Server column definition
  • 2ADF auto-generated schema used VARCHAR(50) but the source occasionally produces longer strings
  • 3A data entry change in the source system introduced longer values without updating the target schema

How to fix it

  1. 1Step 1: Find which column is too short: in SQL Server 2019+ the error includes the column name. For older versions, use SET ANSI_WARNINGS OFF; to find the truncated row, or check column lengths vs. source data max lengths.
  2. 2Step 2: Widen the column: ALTER TABLE [table] ALTER COLUMN [col] VARCHAR(500);
  3. 3Step 3: Or truncate in the pipeline: in ADF Derived Column, use left(col, 255) to clip the value to the column size.

Frequently asked questions

Why does SQL Server 2019 show the column name in error 8152 but older versions don't?

SQL Server 2019 introduced trace flag 460 as the default for error 8152, which adds the column name and actual value length to the error message. In older versions, enable trace flag 460: DBCC TRACEON(460, -1);

How do I find the maximum length of values in a source column?

Run on the source: SELECT MAX(LEN(col)) FROM source_table; — this shows the longest value and tells you the minimum column width needed.

Can ADF auto-detect and avoid truncation errors?

ADF does not automatically resize target columns. You can use the Data Flow Fault Tolerance to skip truncated rows and log them, but this risks data loss. Fix the schema mismatch instead.

Official documentation: https://learn.microsoft.com/en-us/sql/relational-databases/errors-events/mssqlserver-8152-database-engine-error

Other data integrity errors