简体   繁体   English

使用联接更新Openquery上无效的对象名称

[英]Invalid Object Name on Openquery update with join

I have the below query which is giving me an "Invalid object name 'E1'" 我有以下查询,该查询为我提供了“无效的对象名称'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. 即使对两个调用都提供了相同的参数,对FROM子句中对OPENDATASOURCE,OPENQUERY或OPENROWSET的任何调用也将独立且独立于对这些用作更新目标的函数的调用进行评估。 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. 您可以重新定义该查询,但有助于了解GRDATE和其他没有表别名的变量的来源。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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