28 Jul 18 · dan-irving · #teradata ·   Bookmark   ×

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

UPDATE TargetTable
FROM
 (
   SELECT text_id,
      (SELECT MAX(ID) FROM serviceClusters) +
      ROW_NUMBER() OVER (ORDER BY Text_ID) AS newID 
   FROM TargetTable
 ) AS src
SET ID = newID
WHERE TargetTable.Text_ID = src.Text_ID

dan-irving

posted on 28 Jul 18

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

Copied