简体   繁体   中英

Invalid Object Name on Openquery update with join

I have the below query which is giving me an "Invalid object name 'E1'"

As far as I can tell my query is correct, I am wondering if it is as simple as I can not do an update to an open query with a join. any suggestions?

update E1 Set e1.LILRCJ = GRDATE  from Openquery(E1_PROD_ORA, 'Select * From Proddta.F41021') E1
        Inner Join dbo.Temp2
        On E1.LiITM = IMITM
        and ltrim(rtrim(E1.LIMCU)) = E1BU
        and E1.LILOCN = Storage
    where GRDate <> '0'

The documentation says:

Any call to OPENDATASOURCE, OPENQUERY, or OPENROWSET in the FROM clause is evaluated separately and independently from any call to these functions used as the target of the update, even if identical arguments are supplied to the two calls. In particular, filter or join conditions applied on the result of one of those calls have no effect on the results of the other.

This would suggest that you cannot do what you want.

You can rephrase this query, but it would help to know where GRDATE and the other variables with no table aliases come from.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM