using OUTPUT on remote server

  • I have the following:

    INSERT INTO TableB

    VALUES(COL1, COL2,....)

    OUTPUT INSERTED.COL1 INTO AUDITTable(COL1)

    SELECT COL1,COL2,....

    FROM TABLEA

    This is giving me error:

    A remote table cannot be used as a DML target in a statement which includes an OUTPUT clause or a nested DML statement.

    I know that OUTPUT cannot work on remote tables.

    So what is the alternative to this?

    Thanks.

  • Output it to a local table with and move it from there?

  • Are you inserting to a remote table and trying to log it locally?

  • Yes, I am inserting into a remote table. Is there any other option besides selecting the record again and then inserting into an audit table?

    Thanks.

  • You should be able to OUTPUT to another table as long as it's on the remote server as well, because the OUTPUT sees that table as local.

  • You could call a remote stored proc and return values back. That might allow you to use OUTPUT on the remote side, and then when it returns, insert those into an auditing table.

Viewing 6 posts - 1 through 5 (of 5 total)

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