ADF pipeline with upsert throwing error "The data type text cannot be used as an operand to the UNION, INTERSECT or EXCEPT operators because it is not comparable"

Shantanu Dekapurwar 20 Reputation points
2024-04-27T01:42:51.18+00:00

ADF pipeline writing data from AZURE sql to on prem SQL Server with upsert operation.

TEXT fields are part of target system, Even though TEXT fields are not selected in select query and are not mandatory fields still throwing error. I cannot change target system database structure.

Message=The data type text cannot be used as an operand to the UNION, INTERSECT or EXCEPT operators because it is not comparable.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,778 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,624 questions
{count} votes

Accepted answer
  1. Erland Sommarskog 101.4K Reputation points MVP
    2024-04-30T21:02:24.31+00:00

    The best solution is to change the data type of that column to varchar(MAX). Yes, I hear that you say that you can't change it, but tell your stakeholders that they have had eighteen long years to replace this deprecated and mouldy data type. It should have been done a decade ago.

    If they insist on keeping the data type, they will have to keep paying for lame workarounds.

    One possible workaround is to create a view on top of the table where you cast the data type. Your ADF pipeline would work against that view. Then you need to have INSTEAD OF triggers on that view to propagate the operations to the underlying table.

    As I said, I don't know ADF myself, but I would be very surprised if ADF does not permit you to use a custom statement for the operation. And in this operation you would cast the data type.

    But as I said, the best is to fix the data type....


0 additional answers

Sort by: Most helpful