Home Forums SQL Server 2005 T-SQL (SS2K5) pass table name as a parameter in stored procedure RE: pass table name as a parameter in stored procedure

  • mjbkm (9/24/2011)


    Hello. This post was a huge help for me. I am able to get it to work in a stored procedure. Is it possible in a function? Cannot get the same similar code to work in a function.

    Thank you in advance.

    Nope... not possible. You cannot use dynamic SQL in a function.

    Shifting gears a bit... what do you want the function to do?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)