inserting data returned from a sproc into a table

  • i am writing a sproc that calls another sproc. this 2nd sproc returns 3 or 4 rows. i want to be able to insert these rows into a table. this sproc is inside a cursor, as i have to call it many times.

     

    how do i insert the rows that it returns into another table??

  • create table that has columns that fits what the sproc returns.

    INSERT myTable (col1, col2...)

    EXEC @err = myProc

    if (@err <> 0) goto errhandler

    The insert/execute combo is what you're looking for. The @err = myProc is so that you can catch returnvalues from the called proc in @err.

    /Kenneth

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply