• Hugo Kornelis (12/26/2014)


    ...

    (And technically, when the variable in declared but not initialised, the code will still "find" the stored procedures and functions with a name starting with sp_ - it may not concatenate to the string as expected, but they will still be found)

    ...

    Really?

    Without declaring the @Output variable:

    Msg 137, Level 15, State 2, Line 1

    Must declare the scalar variable "@Output".

    With the @Output declared but not initialized:

    NULL

    The fact that the result is NULL would tell me that none of the answers is correct, even if it did find them all, if you are a literalist. Simple reason, how do you know if it worked, literally speaking.

    Also, I wouldn't do it that way any way. I prefer the FOR XML PATH method of generating a list.