Hello @Shreyash Choudhary !
Your queries have some errors
Please try :
WITH Numbered AS (
SELECT
serial_no,
ROW_NUMBER() OVER(ORDER BY (SELECT NULL)) AS new_serial_no
FROM
table_name
WHERE
serial_no IS NULL
)
UPDATE
Numbered
SET
serial_no = new_serial_no;
This is a Common Table Expression (CTE) called Numbered
to generate row numbers for each row in table_name
where serial_no
is NULL
.
Please try this and return your feedback !
I hope this helps!
Kindly mark the answer as Accepted and Upvote in case it helped!
Regards