Azure Data Factory · Schema drift

“Invalid column name” in an Azure Data Factory Copy activity

SQL Server could not find a column that the Copy activity’s query names. Most often the column was renamed or dropped in the source table, or a value placed into a dynamic query lost its quotes and is being read as a column name. Change the query or the column mapping so that it matches the table as it is now.

The error
Failure happened on 'Source' side. ErrorCode=SqlOperationFailed,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=A database operation failed with the following error: 'Invalid column name 'customer_id'.',Source=,''Type=System.Data.SqlClient.SqlException,Message=Invalid column name 'customer_id'.,Source=.Net SqlClient Data Provider,SqlErrorNumber=207,Class=16,ErrorCode=-2146232060,State=1,Errors=[{Class=16,Number=207,State=1,Message=Invalid column name 'customer_id'.,},],'

What this error means

SqlOperationFailed is the Copy activity’s wrapper for an error returned by the database. The part that matters is the database’s own message: Invalid column name, SQL Server error 207. It is raised when the statement is compiled, before any row is read.

Failure happened on 'Source' side tells you that the query reading the data failed. On the sink side, the statement that failed is one that writes, such as a pre-copy script or a stored procedure. A related code, SqlInvalidColumnName, means that a column in the activity’s query, dataset or mapping does not exist in the table.

Why it happens

  • The source column was renamed or dropped. A schema change removed or renamed the column, and the query in the Copy activity, or the view or stored procedure it calls, still uses the old name.
  • A dynamic query lost its quotes. When a query is built with pipeline expressions, a text value without single quotes, as in WHERE region = MNS, is read as a column name. The error then names the value, not a real column.
  • The table never had the column. In a ForEach loop over many tables, one query such as SELECT MAX(updated_at) fails on the first table without that column.
  • The sink table is behind. On the sink side, a pre-copy script, stored procedure or column mapping names a column that was never added to the destination table.

How to fix it

  1. Read the name in the error

    The text in quotes after Invalid column name is what SQL Server could not find. If it looks like a value and not like a column, such as 2025 or MNS, go straight to the dynamic query.

  2. See the query that really ran

    In Monitor, open the failed activity run and view its input. It shows sqlReaderQuery with every expression already replaced by its value.

  3. Compare it with the table

    Run the same query against the database, or list the table’s columns. Find out whether the column was renamed, was dropped, or never existed there.

    List the table’s current columns
    01SELECT name02FROM sys.columns03WHERE object_id = OBJECT_ID('dbo.Orders');
  4. Change the query or the mapping

    Use the current column name. If later steps still expect the old name, alias it. In a dynamic query, put single quotes around text values. For a sink-side error, add the column to the table, or take it out of the mapping, script or procedure.

    Source query: keep the old name for the steps that follow
    01 SELECT order_id,02-       customer_id,03+       client_id AS customer_id,04        total_amount, updated_at05 FROM dbo.Orders;
  5. Rerun and check the row count

    Rerun the pipeline from the failed activity and confirm the rows read and rows written in the copy output.

How to stop it coming back

  • Name the columns in the source query instead of using SELECT *, so a schema change fails clearly at the source.
  • Agree schema changes with the team that owns the source, or read from a view that keeps column names stable.
  • Quote text values in dynamic queries, and test the expression with a value that contains a space.

With PipelineMender AI

The next failed run explains itself.

PipelineMender reads the failed Copy activity’s error, its input and the pipeline definition with the Reader role on the factory. For this failure the report quotes the statement that failed, names the column it could not find, and proposes the changed query or mapping 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.

Why did a pipeline that ran for months start failing with Invalid column name?

Usually because the source table changed and the pipeline did not. A column was renamed or dropped, or the pipeline started receiving a value that it places into a dynamic query without quotes.

What is the difference between SqlOperationFailed and SqlInvalidColumnName?

SqlOperationFailed wraps an error returned by the database, here SQL Server error 207 for a column named in a statement. SqlInvalidColumnName is reported when a column in the activity’s query, dataset or mapping does not exist in the table.

Does the same error appear in Microsoft Fabric pipelines?

Yes. Copy activities in Fabric Data Factory report the same SqlOperationFailed and SqlInvalidColumnName codes, and the fix is the same.

Checked against: Troubleshoot the SQL connectors (Azure Data Factory) Database Engine errors 0 to 999 (error 207) Schema and data type mapping in copy activity Monitor copy activity 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.