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

198 reads

Blogs

Containers: Create a Custom Container

By

Creating a custom container is where things get truly exciting. There’s actually a ton...

Mini-Rant: Spoofed Phone Numbers and Trust

By

I’ve seen this more and more over the last year: I receive a phone...

Speaking at SQL Saturday Dallas

By

Speaking at SQLSaturday Dallas! I’m proud to announce that I will be speaking at SQL...

Read the latest Blogs

Forums

The Change Failure Rate

By Steve Jones - SSC Editor

Comments posted to this topic are about the item The Change Failure Rate

Reporting Server

By Admingod

I have reporting server which gets replicated from other OLTP server.However, the reporting server...

FlushCache Error Message

By bobba

While analyzing an issue, I stumbled on to a "FlushCache" error message (error log). ...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers