I’ve also heard that cursors are generally not fast, but for many of the things I’ve been writing lately, I’ve used cursors a lot. An alternative I’ve come across is using a table variable, and performing what I need on the table records one by one, essentially mimicking a cursor.
In addition, can anyone shed some light on cursors vs. table variables, where each is stored, and the pros/cons of each. It seems like they could be used equivalently, so I’d like to know how to choose which is better for what I’m doing.
Many times, I need to do several things with each record (insert/update records in several supporting tables based on the cursor record and/or values derived from values in the cursor record), and that’s why I’ve been using cursors. So far, I haven’t run into any speed issues; however, my cursors typically hold up to perhaps 30,000 records. However, if anyone has any better approaches, I’d like to hear them.