Home Forums SQL Server 2005 T-SQL (SS2K5) Invalid use of a side-effecting operator 'INSERT EXEC' within a function: RE: Invalid use of a side-effecting operator 'INSERT EXEC' within a function:

  • Ray Herring (8/22/2016)


    This one sure generated a lot of discussion but I don't think (at least I did not see) that anyone addressed the actual code problem in the UDF the OP presented.

    The code includes an Exec statement but MS Documentation pretty clearly states no dynamic SQL in UDF. See BOL

    User-defined functions cannot make use of dynamic SQL or temp tables. Table variables are allowed.

    One, 6 year old thread and the OP quit responding.

    Two, actually I think the OP understood that user-defined functions cannot make use of dynamic SQL, just didn't seem to understand why.