Update table using linked server Openquery

I tried this code and got the following error so far, maybe someone can help?

UPDATE a 
SET    a.MMDWNO = '21'
FROM   OPENQUERY(NMIIFLIB,
       'select * from MVXCDTANSN.MITMAS WHERE MMITTY = ''25''') a 

      

Mistake:

OLE DB provider "MSDASQL" for linked server "NMIIFLIB" returned message "[IBM] [ODBC driver for iSeries access] [DB2 UDB] SQL7008 - MITMAS in MVXCDTANSN is not valid to work."
Msg 7343, Level 16, State 4, Line 1
OLE DB Provider "MSDASQL" for linked server "NMIIFLIB" could not update table "[MSDASQL]".

The select statement works fine, but when I try to update I always stuck with it.

+3


source to share


2 answers


If you are trying to update a table on a linked server try this syntax:



UPDATE OPENQUERY(NMIIFLIB, 'select * from MVXCDTANSN.MITMAS where MMITTY = ''25''')
SET MMDWNO = 21

      

+4


source


you should try this. Hope this helps you.



UPDATE OPENQUERY(firstlink, 'select * from job.dbo.student where id = ''3''') 
    SET name = 'sanjeev acharya'

      

-2


source







All Articles