views:

18

answers:

1

I want to execute the following statement through from a linked server (openquery):

UPDATE SAP_PLANT 
SET (OWNER, OWNER_COUNTRY) = (SELECT import.AFNAME, import.COUNTRY
                                FROM SAP_IMPORT_CUSTOMERS import, SAP_PLANT plant
                                WHERE plant.SAP_FL = import.SAP_NO
                                AND import.role ='OWNER')

I've tried to form it into the following syntax, without success :(

update openquery(‘my_linked_server, ‘select column_1, column_2 from table_schema.table_name where pk = pk_value’)
set column_1 = ‘my_value1′, column_2 = ‘my_value2′

I hope for you this is no problem?

A: 

Are you getting syntax error? Your server parameter in the update openquery is missing a trailing quote. Change `my_linked_server to `my_linked_server'.

bobs