Multi-statement execution

  • Comments posted to this topic are about the item Multi-statement execution

  • This was removed by the editor as SPAM

  • I din't notice the concatenated "delete" statement and I gave wrong answer. Still I don't think it's a good question or at least it's not worth 2 points.

  • I think this is an excellent question. One must read through the script for starters, and catch the subtleties.

    Secondly, there is a concatenation lesson to be learned concerning SQL Injection.

    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

  • I think that this was a very good question. I certainly learned something from it. I was sure that the answer would be 0 and was surprised that I got it wrong. I’ve also noticed that unlike most times we didn’t get a link to any official site that explains this behavior, which brings me to the question - Is this behavior is documented and by design?

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • nice question.. thanks 🙂

  • Wel, Usualy I answer the question by reading it on the screen itself. I never copy and paste it in query analyzer.Had I copied it in query analyzer and read I would have definetly give right answer. Hence I dint feel it's a good question.

  • Tricky question, but not good for learning...good for dry run

  • Joy Smith San (2/3/2010)


    Wel, Usualy I answer the question by reading it on the screen itself. I never copy and paste it in query analyzer.Had I copied it in query analyzer and read I would have definetly give right answer. Hence I dint feel it's a good question.

    So good questions are only the ones you can answer???

  • Joy Smith San (2/3/2010)


    Wel, Usualy I answer the question by reading it on the screen itself. I never copy and paste it in query analyzer.Had I copied it in query analyzer and read I would have definetly give right answer. Hence I dint feel it's a good question.

    I don't understand how your reliance on reading the code in QA to get it right has any bearing on the question being good or not....:unsure: How would reading it in QA (I assume you do mean reading and not executing) have caused you to work out a different answer?

  • Interesting question - I guessed 0 rows - I thought that the dynamic SQL would execute and the results from the last statement - the delete statement would be inserted. Not really tried anything like this before - going to have a play with executing multiple statements in EXEC() and find out how it affects other things like @@rowcount as well. 🙂

  • Really This is not easy for sql newbies .Tricky question

    But You Can Learn more knowledge by this

  • Simon Liddle (2/3/2010)


    I thought that the dynamic SQL would execute and the results from the last statement - the delete statement would be inserted.

    ...and that is nonsense the more I think about it! 🙂

  • Ninja's_RGR'us (2/3/2010)


    Joy Smith San (2/3/2010)


    Wel, Usualy I answer the question by reading it on the screen itself. I never copy and paste it in query analyzer.Had I copied it in query analyzer and read I would have definetly give right answer. Hence I dint feel it's a good question.

    So good questions are only the ones you can answer???

    I dint mean it. I mean to say, this question is just tricky.

    Playing with words and nothing else.

  • Simon Liddle (2/3/2010)


    Joy Smith San (2/3/2010)


    Wel, Usualy I answer the question by reading it on the screen itself. I never copy and paste it in query analyzer.Had I copied it in query analyzer and read I would have definetly give right answer. Hence I dint feel it's a good question.

    I don't understand how your reliance on reading the code in QA to get it right has any bearing on the question being good or not....:unsure: How would reading it in QA (I assume you do mean reading and not executing) have caused you to work out a different answer?

    Yes, you are right. I dont execute and just read it.

    The difference is that, as you know when you copy it in QA color changes. I would have easily found that delete statement was a string appended to the insert statement.

    Anyways, I was just saying my opinion. Hope I have the freedom to post what I feel, instead of simply praising always.

    And yes, probably for a beginner it might be a good question. I agree.

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

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