I want to select rows until I found a certain value and it\'s not numeric so I cannot use > or <. How can I do this ?
Example :
-----
Value
----
You can just use an equality comparator in the query, to directly search the value you're looking for.
Why would you want to loop through your database until you found it when you can just specify what you're searching for ?
You didn't give an example of what value it is you're searching for, so if it is a string
Select x.* from table x WHERE x.Column = 'String Value'
However, if you do want to put some extra load on your database (which it is in this undefined case), you'd have a stored procedure, looping through ID's stored in the database.
For that, take a look at the following post, which might give you some inspiration : SQL LOOP INSERT Based on List of ID's