I found the technique to update rows of a table with consecutive numbers here:
Update SQL with consecutive numbering
The gist of the technique is to use (T-SQL):
update myTable
SET @myvar = myField = @myVar + 1
which is awesome and works very well.
Can this technique be extended to number different groups of records, with each group starting with 1 ? e.g.
- Category 1 rows should get a sequence number 1,2,3,....
- Category 2 rows should also get a sequence number 1,2,3,.....