I have a table of values like this:
CREATE TABLE
(
Name1 VARCHAR (50),
Name2 VARCHAR (50),
Sequence INT
)
In this table I have rows like this
'Bob', 'Jones', 1
'James','Ant', 2
I want the best way to UPDATE (UPDATE SET) sequence based on the order of say the Name2 column, so when re-sequenced the values are:
'James','Ant', 1
'Bob', 'Jones', 2
I am pretty sure this can be done with a ROW_NUMBER OVER() style of CTE but not sure of the exact syntax.