You can sort of do loops in SQL. Its not as nice as in regular programming but you do have a WHILE loop.
All you have to do is this:
WHILE whileCondition
BEGIN
What to do in the loop
END
I had to do some parsing of a string and I had to cycle through each letter to find a particular subset of characters.
There is also FETCH/NEXT but this is much easier
MAKE SURE THAT YOU WILL HIT YOUR WHILE CONDITION OR YOU WILL BE IN AN INFINTE LOOP :)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment