fast farward curson vs while loop on @table

  • hi,

    need to known weather fast farwand cursor is faster than a while loop made on @table variable haveing less than 15 rows that means 15 iteration.

    pls tell me which one is faster.

  • What happened when you tried it?

    with only 15 records, I'm not sure you'll see a huge difference, but give it a try and record both times. I didn't write this to be mean or ugly, but you learn most by doing - by trying multiple options and seeing which one works best.

  • but main question is why you need a cursor/while loop?

  • Frederico has the best question. Do you need a loop? What's the problem and data? Can you post or mock this up?

    As pietlinden noted, 15 rows might not matter, but it might. If this runs 1,000s of times a second, then maybe you care. What I'd do is test this at scale. Either over and over (loop over your loop) or add data and try 1.5mm rows. Then compare which works better.

     

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply