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

203 reads

Blogs

What the ???? T-SQL Tuesday #120

By

Hey, it’s T-SQL Tuesday again! I almost forgot about it what with Summit and...

First Time Speaking at PASS Summit

By

This week, I filmed my experience as a first time speaker at PASS Summit...

Azure SQL Best Practices?

By

A way to enforce good practice and standards is by Azure Policy. As stated...

Read the latest Blogs

Forums

Limiting the Data Frame

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Limiting the Data Frame

Micro Credentials

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Micro Credentials

CheckDB on VLDB, Geography data type

By el_Guapo

I've narrowed down a DBCC CheckDB issue to a set of tables with Geography...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers