Swasti Das
Swasti Das

Reputation: 11

I'm trying to update the sequence no of the file after deleteing a record from it in SQL DB2

WITH RowNumbers AS 
(   
    SELECT 
        ROW_NUMBER() OVER (ORDER BY G TLINE) AS row_num, 
        gtline, gttran  
    FROM 
        GPOTRSP
) 
UPDATE b  
SET b.gtline = a.row_num 
FROM GPOTRSP b  
JOIN RowNumbers a ON b.gtline <> a.gtline  
                  AND b.gttran = a.gttran

I want to resequence the line no after deletion on one record.

Upvotes: 1

Views: 24

Answers (0)

Related Questions