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

332 reads

Blogs

Ethics in Modern Data this Saturday with the South Florida Data Geeks

By

This Saturday Aug 7, Christine and I will present our joint presentation on Ethics...

3 Reasons Why Focusing on Tech Is The Worst Way To Deploy a HA/DR Solution

By

This past Thursday, Edwin Sarmiento presented a session for our Microsoft Data Platform Continuity...

The PowerBI Volleyball Report – Organizing Data To Start

By

One of my goals this year was to build a report that I can...

Read the latest Blogs

Forums

Minimun Role Permissions Needed

By Lou

Hi Friends, Please some guidance, To import a bacpac file in a MI instance,...

Need counts of payment amounts per week grouped by week

By joewhite

Hello, I have a code that suppose to give me weekly(summed) payments, but instead,...

Import CSV Data Into Existing Tables

By VSCurtis

Hi Guys, I am having issues trying to import data from CSV files into...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers