Addressing cursors using a field.(SQL Server) -


I have a table that I process using the cursor let's say that its structure is such: RID | School | Order |

Now, I filter other schools (so only I have been shown) and then I order according to the order, so that I can find the text how I want to. Now, my problem is that this sequence is not directly rising (although all of them are unique to school) it can be lost from 1,2,3,200,823 and so on. But with the original order value cursor (Absolute) with the command ORDER ORDER = ORDER

ORDER I originally

ex> SELECT * Use it also) It adjusts the table so that when an order field exits (from 1 to 2 to 100), then it thinks that ORDER = 100 is the third line in its internal table, as it should be

But is it possible to resolve such a situation with the cursor so that I < Pre> FETCH ABSOLUTE 100 ..

Can I really do ORDER = 100?

It sounds good to me as if you're not using the cursor better and Only Thorrein's response was left in response to comments on one line at a time. Something like this:

  Announce all the variables to capture individual columns ... Declare the @CurrentOrder ... set the appropriate datasets @CurrentOrder = ... while the initial value ( 1 = 1) Start @ Var1 = Column 1, @ Var2 = Column 2, etc., @GotoWhere = GotoWhy where the command from SCHOOL_DATA = order @ @CurrentOrder @ RC = @@ Rochekount, @E = @@ Error handling If @RC & lt; & Gt; 1 or @ a and lt; & Gt; 0. Try to catch up to work using the 2005 + .... ... error out if @goto is zero then (... condition condition ...) set exit @CurrentOrder = @GotoWhere termination  

Comments