February 26, 2013 at 1:04 pm
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.
February 26, 2013 at 4:28 pm
Output it to a local table with and move it from there?
February 26, 2013 at 5:00 pm
Are you inserting to a remote table and trying to log it locally?
February 27, 2013 at 1:39 pm
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.
February 27, 2013 at 2:17 pm
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.
February 27, 2013 at 2:17 pm
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