My stored procedure updates the Branch# and Sales figure correctly. What SQL code can I write to update the Rank column (NB. this is ranking by Sales).
If it's few records in the table, I would create a stored procedure that updates the current Branch, then after that I would create a temp table with identity id (the rank) and insert the rows from your originally table ordered by Sales.
After that update the rank from the temp table.
I'll hope this can help you.
Regards
/Mattias
ps. another solution is to calculate the rank everytime you fetch the data, depending on your solution.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.