SQL SERVER
-
how do u do looping in T-SQL?
-
how do u do looping in T-SQL?
I like WHILE loop :)
Farhan Noor Qureshi
-
how do u do looping in T-SQL?
It depends on what you are trying to do. If you can do the operation using a set based operation (what SQL is optimised for) then you are better doing it that way. If you are looping over a counter then a WHILE loop is useful. If you are looping over rows in a database then you might want to look at CURSORs. However, if you are tempted to use cursors then I would really suggest trying to find a set based method for the same thing first and use CURSORs as a last resort.
Upcoming Scottish Developers events: * UK Security Evangelists On Tour (2nd November, Edinburgh) * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog