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

205 reads

Blogs

Extended Events Misperceptions: Profiler is Easier

By

I know, I know, I’m on #teamexevents so I think that Extended Events can...

I’m Speaking at #SQLSatSpokane

By

I am super excited to announce that I have been selected to speak at...

Common commands and tasks to make dealing with Windows Core easier.

By

I don’t know how many of you are working with Windows Core these days...

Read the latest Blogs

Forums

Move Data from SQL Server to Azure Blob Storage with Incremental Changes – Part 2

By Ginger Keys Daniel

Comments posted to this topic are about the item Move Data from SQL Server...

Knowing What You Don’t Know

By Grant Fritchey

Comments posted to this topic are about the item Knowing What You Don’t Know

Automate Import of LIBOR Rates

By Phil Parkin

Does anyone have any recommendations for sites which publish the daily LIBOR rates in...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers