Technical Article

Update a table column with a sequence number v3

Both Sachinvaishnav and Mark Chad have submitted scripts to populate a column with a sequence number. The first solution uses a cursor; the second uses the SQL 2005 ROW_NUMBER() function.v1:http://www.sqlservercentral.com/scripts/viewscript.asp?scriptid=1643v2:http://www.sqlservercentral.com/scripts/viewscript.asp?scriptid=1664Since neither script requires a specific order for the sequence number, the same result can be achieved with a single UPDATE statement.

2006-04-26 (first published: )

362 reads

Blogs

Cloud Formations – A New MVP Led Training Initiative

By

Hello, data friends! Let me spread a few words about the new MVP led...

Daily Coping 20 May 2020

By

I started to add a daily coping tip to the SQLServerCentral newsletter and to...

Daily Coping 19 May 2022

By

I started to add a daily coping tip to the SQLServerCentral newsletter and to...

Read the latest Blogs

Forums

Columnstore Index Limits in SQL Server 2019

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Columnstore Index Limits in SQL...

How to use Images in Power BI Report Builder

By Daniel Calbimonte

Comments posted to this topic are about the item How to use Images in...

How to handle sticks on column country1 and country2 columns ?

By ahmed_elbarbary.2010

I work on sql server 2017 i have table data as below i need...

Visit the forum

Ask SSC Logo Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers