there are a few potential problems.
1) you do a SELECT TOP 1 with no ORDER BY Clause. The order of rows returned is not guaranteed! it will usually be in CLUSTERED INDEX order (PK usually) but it isn't guaranteed.
If you must do things this way (row by row processing). Then create a temp table or table variable and insert the processed rows into that. Then do a final select at the end.
But whatever you are doing, there is probably a better way than row by bloody row.
Msg 3903.. The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION.http://nosqlsolution.blogspot.co.uk/