using SQL server 2008.
Hi guys got this query here:
CREATE PROCEDURE [dbo].[GenerateNumbers]
@pg varchar(255)
AS
BEGIN
DECLARE @Counter as int
SET @Counter = 0
UPDATE dbo.paretoMain
SET @counter = NewPareto = @counter +1
WHERE PG = @pg
END
Works fine, only i want it to do this by a particular order of 1 column. basically order by column 1.
cant seem to figure out how though any ideas?
thanks guys!
EDIT:
Ok seems I've confused people so here goes.
3 columns in a table. 1 called "newpareto" 1 called "Sales" 1 called "part". Sales has currency, part is varchar. Newpareto is blank.
I want to simply 100 numbers for 100 records (example), so when row1, Newpareto = 1. This query i provided does this. However. The 100 Records are not sorted. What i need is To somehow add order by in there to order by Sales column so that the top Sales (example £100.00) will be number 1 in the Newpareto column. Any clearer?