CURSOR LOOP

  • Comments posted to this topic are about the item CURSOR LOOP

    Thanks,
    Naveen.
    Every thought is a cause and every condition an effect

  • Boh!

  • Back to basics...an easy qotd! Thanks Naveen.

    ~ Lokesh Vij


    Guidelines for quicker answers on T-SQL question[/url]
    Guidelines for answers on Performance questions

    Link to my Blog Post --> www.SQLPathy.com[/url]

    Follow me @Twitter

  • Good basic question, thanx

    Thanks & Best Regards,
    Hany Helmy
    SQL Server Database Consultant

  • Very basic question.

    Igor Micev,My blog: www.igormicev.com

  • Didn't even notice the position outside the While loop. The fact that the variable is set to 1 on the previous line means that even if it were within the loop the answer would be the same.

  • Toreador (8/5/2015)


    Didn't even notice the position outside the While loop. The fact that the variable is set to 1 on the previous line means that even if it were within the loop the answer would be the same.

    That's the way I saw it, too.

  • tom.w.brannon (8/5/2015)


    Toreador (8/5/2015)


    Didn't even notice the position outside the While loop. The fact that the variable is set to 1 on the previous line means that even if it were within the loop the answer would be the same.

    That's the way I saw it, too.

    Me three. Didn't even look at the loop.

  • andrea4618 (8/5/2015)


    tom.w.brannon (8/5/2015)


    Toreador (8/5/2015)


    Didn't even notice the position outside the While loop. The fact that the variable is set to 1 on the previous line means that even if it were within the loop the answer would be the same.

    That's the way I saw it, too.

    Me three. Didn't even look at the loop.

    Yeah, I missed that too. It must be a better question than I thought. 😉 Thanks.

  • Spotted this one right away. Thanks.

  • Easy question but not really sure what the point of the question was.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • I stared at it for a really long time, went back and forth on where the loop goes to, eventually decided that it wouldn't get set to one each time, and then promptly forgot that the print statement was outside the loop.....gah!

  • I was expecting that there should be a PRINT statement missing inside the loop. Eventhough I decided to go with the correct answer, apparently for the intended reasons (PRINT outside of the loop).

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • I liked the question. Thanks

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Ed Wagner (8/5/2015)


    andrea4618 (8/5/2015)


    tom.w.brannon (8/5/2015)


    Toreador (8/5/2015)


    Didn't even notice the position outside the While loop. The fact that the variable is set to 1 on the previous line means that even if it were within the loop the answer would be the same.

    That's the way I saw it, too.

    Me three. Didn't even look at the loop.

    Yeah, I missed that too. It must be a better question than I thought. 😉 Thanks.

    Good point. Initially, I saw the case where Setting the variable is outside the loop and Print is inside the loop. It could make more sense if I put outside loop like this:

    If @BitToggle=0 Print 'Variable @BitToggle toggled'

    SET @BitToggle = 1

    Thanks,
    Naveen.
    Every thought is a cause and every condition an effect

Viewing 15 posts - 1 through 15 (of 18 total)

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