Skip to content
Advertisement

Sequence Numbering in SQL Server

I have an table (always ordered by ID ascending) with 5 records as such :

And the desired output is :

Advertisement

Answer

If you want to do this in one step:

If you have to do many of these updates, then separate calls to update incur extra overhead.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement