• L' Eomot Inversé (3/24/2013)


    Nice question.

    But does the fourth batch fail with an error or with two errors? Anyone, I find it surprising that the two error messages give the same line number, as the first refers to the nested select which begins on the second line of the statement while the second error applies to the call to dbo.Test which is part of the main query, and the main query can't begin on the second line of itself.

    Technically Tom, you are right that the fourth batch fails with two errors. I thought it might be a little much to expect people to realize that it would throw 2 so I left the proposed answer as "an error."

    L' Eomot Inversé (3/24/2013)


    Nice question.

    The fifth batch will fail as well of course since a batch separator has to be the first thing other than comments and white space on its line, so if anyone runs it their db will remain cluttered up with the type and the sproc.

    Ah yes. It appears the lack of line breaks is some artifact of the question submission process. In my original script, the two drops and the batch separator were all on separate lines.


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St