1

I am performing an UPSERT operation in a Synapse Dedicated SQL Pool. The TARGET table has 394 column and I am trying to update the TARGET with 5 Unique Keys.

MERGE table_A AS TARGET using
  (SELECT <col_1>,<col_2>...<col_394> FROM table_B) AS SOURCE 

  ---Unique Constrains---
  ON TARGET.col_1 = SOURCE.col_1 AND TARGET.col_2 = SOURCE.col_2
  AND TARGET.col_3 = SOURCE.col_3 AND TARGET.col_4 = SOURCE.col_4
  
  WHEN MATCHED THEN UPDATE SET
  TARGET.col_5 = SOURCE.col_5,
  ......
  TARGET.col_394= SOURCE.col_394
  WHEN NOT MATCHED BY TARGET THEN INSERT
  (
  <col_1>...<col_394>
  )
  VALUES
  (
  SOURCE.<col_1>,
  ....
  SOURCE.<col_394>
  )

This is giving an error whose I have no clue.

Msg 1702, Level 16, State 1, Line 1
CREATE TABLE failed because column '<col_88>' in table 
'QTable_fd9d2c424ae54f7e8aced139aa6b511d_58' exceeds the maximum of 1024 columns.

Just to be noted here that TARGET table has HASH DISTRIBUTION ON <col_2> AND having PRIMARY KEY NONCLUSTERED on the above 4 columns.

Why I am getting that error? What is the way out?

1
  • How many columns does table_A have? Probably the join of these two tables exceeds 1024 columns....
    – MBuschi
    Jul 28 at 8:57

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.