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: )

242 reads

Blogs

SQL Clone Works with FILESTREAM

By

SQL Clone is an amazing product that virtualizes your data, allowing multiple instances to...

Fun and profit with UTF-8

By

When SQL Server 2019 was announced, it brought with it UTF-8 support. Also available...

Data Platform MVP 2020

By

I am humbled to be among so many great professionals and honored at the...

Read the latest Blogs

Forums

Removing TDE from a Database: Level 4 Stairway to TDE

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Removing TDE from a Database:...

Database Modeling - Relationships

By ukashishgarg

Comments posted to this topic are about the item Database Modeling - Relationships, which...

Read database objects relationship in easy steps

By ukashishgarg

Comments posted to this topic are about the item Read database objects relationship in...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers