Azure Data Factory · Data types

“String or binary data would be truncated” in an Azure Data Factory Copy activity

A value in the source is longer than the sink column that receives it. SQL Server will not cut it short, so the copy stops. Find the column and the value, then widen the column or shorten the value on purpose.

The error, as it appears
ErrorCode=SqlBulkCopyInvalidColumnLength,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=SQL Bulk Copy failed due to receive an invalid column length from the bcp client.,Source=Microsoft.DataTransfer.ClientLibrary,'
String or binary data would be truncated in table 'SalesDb.dbo.Customers', column 'city'. Truncated value: 'San Franci'.

What this error means

When a value does not fit the destination column, the database refuses the batch. Depending on how the rows are written you see the Copy activity’s SqlBulkCopyInvalidColumnLength, or SQL Server’s own message: error 2628, which names the table, the column and the start of the value, or the older error 8152, which names nothing.

Behind the bulk copy code is SQL Server error 4815, Received an invalid column length from the bcp client for colid N. If your message includes it, N is the position of the column in the sink table, counted from 1.

Why it happens

  • The source field grew. A source system now allows longer names, codes or free text than the sink column was sized for.
  • The sink table was created too narrow. It was created by hand or from a small sample, for example as varchar(10), and real values are longer.
  • Wider characters in a varchar column. varchar(n) is sized in bytes. Text with multi-byte characters under a UTF-8 collation can exceed it with fewer than n characters.
  • A mapping sends a column to the wrong place. After a change in the source, a long column is mapped to a short one.

How to fix it

  1. Get the column name

    Error 2628 names the table, the column and the beginning of the value. If you only have SqlBulkCopyInvalidColumnLength or error 8152, continue with the next step.

  2. Catch the rows that fail

    Turn on fault tolerance in the Copy activity, so incompatible rows are skipped and written to a log file in storage. Microsoft recommends this to identify the row. It makes the run slower, and it does not apply to upserts or to sinks that call a stored procedure, so use it to diagnose.

    Copy activity: skip incompatible rows and log them
    01"typeProperties": {02  "source": { "type": "AzureSqlSource" },03  "sink": { "type": "AzureSqlSink" },04  "enableSkipIncompatibleRow": true,05  "logSettings": {06    "enableCopyActivityLog": true,07    "copyActivityLogSettings": { "logLevel": "Warning" },08    "logLocationSettings": {09      "linkedServiceName": { "referenceName": "LogStorage", "type": "LinkedServiceReference" },10      "path": "copy-errors/"11    }12  }13}
  3. Compare the lengths

    Measure the longest value in the source and compare it with the defined length of the sink column.

    How long the values really are
    01SELECT MAX(LEN(city)) AS longest_value02FROM src.Customers;
  4. Widen the column, or shorten on purpose

    If the longer values are valid, alter the sink column and keep its NULL or NOT NULL setting. If they are not valid, trim or reject them in the source query, so the rule is visible to the next person.

  5. Switch fault tolerance off again and rerun

    Unless skipped rows are acceptable in production, switch it off, rerun, and confirm that rows read equals rows written.

How to stop it coming back

  • Size text columns from the limits of the source system, not from a sample of today’s data.
  • Tell the team that owns the source which columns have a fixed size downstream.
  • Check the length in the source query for columns that must stay short, so a violation is reported with the row that caused it.

With PipelineMender AI

The next failed run explains itself.

PipelineMender reads the failed Copy activity’s error, its input and output, and the pipeline definition with the Reader role on the factory. When the error names the column and the value, the report quotes them, relates them to the mapping in the pipeline, and proposes the change for you to review.

Is the error in front of you now? Start a trial, choose Report an incident and paste it in. No connection is needed for that.

  • Read-only access
  • You review every change
  • No model training

Questions

Common questions about this error.

Which column is too short?

SQL Server error 2628 names the table, the column and the beginning of the value. Error 8152 and SqlBulkCopyInvalidColumnLength do not, so log the failing rows with fault tolerance and compare the longest source values with the sink column lengths.

Can Azure Data Factory truncate the value for me?

Not on its own. Shorten the value yourself in the source query, for example with LEFT, or skip incompatible rows with fault tolerance and review the log.

Is this the same in Microsoft Fabric?

Yes. Fabric Data Factory documents the same SqlBulkCopyInvalidColumnLength code and the same guidance for truncated string or binary data on SQL destinations.

Checked against: Troubleshoot the SQL connectors (Azure Data Factory) Fault tolerance of copy activity Database Engine errors 2000 to 2999 (error 2628) Database Engine errors 4000 to 4999 (error 4815) Database Engine errors 8000 to 8999 (error 8152) Troubleshoot the SQL connectors (Microsoft Fabric)

Last reviewed 13 November 2026 against Microsoft’s documentation. PipelineMender AI is an independent product and is not affiliated with Microsoft or Databricks; product names are trademarks of their owners.