![](/img/trans.png)
[英]The multi-part identifier “DB1..Students.studentnumber” could not be bound
[英]The multi-part identifier could not be bound using a linked server with ODBC connection to a DB2
当我运行这个简单的查询
select [B00BF4CR].[IWSE4S8].[SCTRN].[STCOMP],
[EPAK].[B00BF4CR].[IWSE4S8].[SCTRN].[STDATE],
[EPAK].[B00BF4CR].[IWSE4S8].[SCTRN].[STUNM],
[EPAK].[B00BF4CR].[IWSE4S8].[SCTRN].[STQTY]
FROM [EPAK].[B00BF4CR].[IWSE4S8].[SCTRN]
WHERE [EPAK].[B00BF4CR].[IWSE4S8].[SCTRN].[STCOMP]='51'
AND [EPAK].[B00BF4CR].[IWSE4S8].[SCTRN].[STDATE] = 20140211
AND [EPAK].[B00BF4CR].[IWSE4S8].[SCTRN].[STVOID] = 'N'
ORDER BY [EPAK].[B00BF4CR].[IWSE4S8].[SCTRN].[STTCKT]
在我的SQL我得到以下错误
Msg 4104, Level 16, State 1, Line 3
The multi-part identifier "EPAK.B00BF4CR.IWSE4S8.SCTRN.STCOMP" could not be bound.
Msg 4104, Level 16, State 1, Line 4
The multi-part identifier "EPAK.B00BF4CR.IWSE4S8.SCTRN.STDATE" could not be bound.
Msg 4104, Level 16, State 1, Line 4
The multi-part identifier "EPAK.B00BF4CR.IWSE4S8.SCTRN.STVOID" could not be bound.
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "B00BF4CR.IWSE4S8.SCTRN.STCOMP" could not be bound.
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "EPAK.B00BF4CR.IWSE4S8.SCTRN.STDATE" could not be bound.
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "EPAK.B00BF4CR.IWSE4S8.SCTRN.STUNM" could not be bound.
Msg 4104, Level 16, State 1, Line 2
The multi-part identifier "EPAK.B00BF4CR.IWSE4S8.SCTRN.STQTY" could not be bound.
Msg 4104, Level 16, State 1, Line 5
The multi-part identifier "EPAK.B00BF4CR.IWSE4S8.SCTRN.STTCKT" could not be bound.
当我对第一个进行两次重复操作时,请突出显示此部分
FROM [EPAK].[B00BF4CR].[IWSE4S8].[SCTRN]
WHERE [EPAK].[B00BF4CR].[IWSE4S8].[SCTRN].[STCOMP]='51' AND
第二和第三
[EPAK].[B00BF4CR].[IWSE4S8].[SCTRN].[STDATE] = 20140211
AND [EPAK].[B00BF4CR].[IWSE4S8].[SCTRN].[STVOID] = 'N' ORDER BY
4、5和6
select [B00BF4CR].[IWSE4S8].[SCTRN].[STCOMP],
[EPAK].[B00BF4CR].[IWSE4S8].[SCTRN].[STDATE],
[EPAK].[B00BF4CR].[IWSE4S8].[SCTRN].[STUNM],
7
[EPAK].[B00BF4CR].[IWSE4S8].[SCTRN].[STQTY]
8
[EPAK].[B00BF4CR].[IWSE4S8].[SCTRN].[STTCKT]
最多可以有四个部分的符号。 您的查询使该规则的列名称无效。 表别名非常有用,可以避免此问题。
[LINKEDSERVER]。[数据库]。[OWNER]。[对象]
这是查询的重写。
-- Use a table alias
SELECT
S.[STCOMP],
S.[STDATE],
S.[STUNM],
S.[STQTY]
FROM
[EPAK].[B00BF4CR].[IWSE4S8].[SCTRN] AS S
WHERE
S.[STCOMP]='51' AND
S.[STDATE] = 20140211 AND
S.[STVOID] = 'N'
ORDER BY
S.[STTCKT]
通过DB2OLEDB使用分布式查询处理(DQP)进行更新和删除时会遇到一些问题。
有关此警告,请参阅下面的文章,以及通过查询和链接服务器进行传递的示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.