I am reading a book for stored procedures and they are explaining cursors inside it but i didn't happen to find a decent use for Cursors or a rule scenario where Cursor usage is a must.
Asked
Active
Viewed 95 times
0
-
1Godo thing you didn't find a sample! You should **avoid cursors** at all costs - they're evil monstrosities, and more than 90% of the time, they're not neeed, nor are they really useful. Do your stuff **in a set-based manner** - much better approach than the **Row-by-agonizing-Row** approach used in cursors.... – marc_s Sep 01 '11 at 09:24
1 Answers
0
You can use cursors when you want to loop on a result set from a select statement to do something with each row. It is like the foreach in any programming language.

Samir Adel
- 2,691
- 2
- 15
- 16
-
-
then why do i need to do that ? cant i just filter the result in the query and have what i need exactly inside the select statement ..... – N Jay Sep 01 '11 at 12:56