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

315 reads

Blogs

How to get data in a DataFrame via .NET for Apache Spark

By

When I first started working with Apache Spark, one of the things I struggled...

The End of PASS

By

I think our profession was the better for having a professional association, even if...

Platforms for Events

By

in my last post I wrote about thinking of the tools as being a...

Read the latest Blogs

Forums

Linked Server Insert error

By natigsqlserver

Hello i have linked server one server in cloud one is local from local...

Default Credentials

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Default Credentials

Re-OPENing a Cursor

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Re-OPENing a Cursor

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers