Teradata UPDATE FROM syntax using row Number

Solution:

Here's the teradata update from syntax.  You have to specify the row_number in the inner derived table

\n\n
UPDATE TargetTable\nFROM\n (\n   SELECT text_id,\n      (SELECT MAX(ID) FROM serviceClusters) +\n      ROW_NUMBER() OVER (ORDER BY Text_ID) AS newID \n   FROM TargetTable\n ) AS src\nSET ID = newID\nWHERE TargetTable.Text_ID = src.Text_ID\n

dan-irving

posted on

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds