Here is my SQL query:
set StratLevel = 3
where prov_id in (select TOP 50 PERCENT Prov_ID FROM ##tmp_results ORDER BY ScoreOverall DESC)
Basically, it is dumping results that meet the search criteria into a ##global_temp table.
I would like to keep the functionality of this query intact AND be able to add an incremented value (+1 for each row updated) to a field (In the example below, "Rank" would be the field containing the incremented values).
ScoreOverall Prov_ID Rank
------------ ------- ----
100 Gary 1
87 Bob 2
85 Neil 3
79 Jack 4
Is there a way I can add this funtionality to the existing query?
I am trying to stay away from using a cursor to accomplish this procedure -- they are PAINFULLY slow!