• I don't think that this row by row operation could really help some one ..

    because this code does not give the clear view of row by row operation ...

    Instand of using this thing u can use the Table variable while loop which help lot compare to Cursor...

    Here is the Logic.....

    --Create a Table Variable and Variable Counter

    DECLARE @InitialTable TABLE(RowNo INT IDENTITY(1,1) NOT NULL PRIMARY KEY CLUSTERED, Field1 int, Field2 Int)

    DECLARE @IncrementalCounter INT        'This variable is declare for Loop

    --All values are inserted into Your Table Variable ........

    Insert into @InitialTable (field1, Feld2)                                              

    Select A1, A2 from Your_Table Where  Your_Condition

    ----------------------------------------------------------

    --Initialize the Counter

    SET @IncrementalCounter = 1

    --Condition of Checking the No of records to be traverse

    while @IncrementalCounter <= ISNULL((SELECT COUNT(RowNo) FROM @InitialTable),0)

    BEGIN

    --Here we set the variable value to the @variable

    SELECT @Variable = Field1 FROM @InitalTable where RowNo = @IncrementalCounter

    SET @IncrementalCounter = @incrementalCounter +1

    END