0

I'm trying to insert some rows from local table, to a remote table.

begin distributed tran
begin try
    insert into [ali\servername].[dbname].[dbo].[mytable] select col1, col2 from mytable;
    commit
end try
begin catch
    print 'fail'
    rollback tran
end catch

But I get this error :

OLE DB provider "SQLNCLI11" for linked server "ali\servername" returned message "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done."

I found this article but there is no way to fix problem in SSMS. Anyone can help?

Thanks in advance.

2
  • Did you try doing this in reverse? Perform the insert locally and do your select remotely?
    – Jason B.
    Jul 25, 2017 at 23:01
  • @JasonB. in reverse?! i want to insert in a linked server's table. how can i select from local within remote server?
    – ABS
    Jul 25, 2017 at 23:04

1 Answer 1

1

For linked servers you have to executed like this (specify columns you are inserting into):

insert into [ali\servername].[dbname].[dbo].[mytable] 
(col1, col2)
select col1, col2 from mytable;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.