After reading this question, I have another similar question. Is there a simple way to get this SQL statement to work?
update [Insurances] set [RowNo]=ROW_NUMBER() over (order by [RowNo])
I have a RowNo
column which I want to update whenever a record is deleted.
UPDATE t1
SET t1.RowNo = s.RowNo
FROM [Insurances] t1
INNER JOIN
(
SELECT Id, ROW_NUMBER() OVER( ORDER BY Somefield DESC) RowNo
FROM Insurances
) s ON t1.Id = s.Id
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With