Home Forums SQL Server 2014 Development - SQL Server 2014 How to call procedure from function. Getting error Invalid use of side-effecting or time-dependent operator in 'INSERT EXEC' within a function. RE: How to call procedure from function. Getting error Invalid use of side-effecting or time-dependent operator in 'INSERT EXEC' within a function.

  • mote.ajit2 (12/4/2013)


    Hi!

    I am trying to call procedure from function but getting following error.

    Invalid use of side-effecting or time-dependent operator in 'INSERT EXEC' within a function.

    Actually I want table valued function so that I can use it in outer apply to process every left input.

    and in that function I am calling another already available procedure.

    may be this is not valid here but another alternative I can see is use of cursor which I have to prevent because of possible slowness of query.

    Can anybody suggest some workaround?

    you'll most likely have to change your function into a procedure instead. functions have a number of rules that have to be followed; dynamic SQL is one of the items not allowed, as well as others. if you show us your function or better explain what you are trying to do, we can help better.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!