当我从使用 odbc 连接的 Microsoft Access 运行此传递查询时,它工作正常:
SELECT b.PRODUCT, b.UPC_NBR, b.EAN_NBR, b.NAME AS ProductDescription, b.AUTHOR,
o.RETAILER, o.REFER_NBR, o.ARDESC, a.NAME, o.TRAN_DATE,
o.QTY, o.RETAIL, o.PRICE, o.COST
FROM BOOK_MASTER_REC as b JOIN
ORBDETL_RECORD as o ON ISBN_TITLE = o.TITLE
AND ISBN_PUBLISHER = o.BK_PUBL
AND BOOK_GROUP = o.BK_GROUP
AND BOOK_PREFIX = o.BK_PREFIX JOIN
ARDESC_RECORD as a ON o.ARDESC = a.ARDESC
WHERE b.PRODUCT Between 600 And 698
当我从通过链接服务器使用相同 odbc 连接的 SMSS 运行相同的查询时,它会失败:
SELECT b.PRODUCT, b.UPC_NBR, b.EAN_NBR, b.NAME AS ProductDescription, b.AUTHOR,
o.RETAILER, o.REFER_NBR, o.ARDESC, a.NAME, o.TRAN_DATE,
o.QTY, o.RETAIL, o.PRICE, o.COST
FROM DPS_GPR..root.BOOK_MASTER_REC as b INNER JOIN
DPS_GPR..root.ORBDETL_RECORD as o ON ISBN_TITLE = o.TITLE
AND ISBN_PUBLISHER = o.BK_PUBL
AND BOOK_GROUP = o.BK_GROUP
AND BOOK_PREFIX = o.BK_PREFIX INNER JOIN
DPS_GPR..root.ARDESC_RECORD as a ON o.ARDESC = a.ARDESC
WHERE b.PRODUCT Between 600 And 698
它给出了以下错误:
链接服务器“DPS_GPR”的 OLE DB 提供程序“MSDASQL”返回消息“[Transoft][TSODBC][usqlsd]')' 应在此处 (FROM)”。Msg 7321, Level 16, State 2, Line 2 准备查询“SELECT Col1061,Col1062,Col1064,Col1065,Col1066,Col1042,Col1048,Col1049,Col1050,Col1051,Col1052,Col1053,Col1054,Tbl1005.NAME Col1040 时出错FROM root.ARDESC_RECORD Tbl1005,(SELECT Col1057,Col1058,Col1059,Col1060,Col1061,Col1062,Col1064,Col1065,Col1066,Tbl1003.RETAILER Col1042,Tbl1003.BK_PREFIX Col1043,Tbl1003.BK_GROUP Col1044,Tbl1003.BK_PUBL Col1045,Tbl1003.TITLE Col1046 ,Tbl1003.REFER_NBR Col1048,Tbl1003.ARDESC Col1049,Tbl1003.TRAN_DATE Col1050,Tbl1003.QTY Col1051,Tbl1003.RETAIL Col1052,Tbl1003.PRICE Col1053,Tbl1003.COST Col1054,bl10107.T3 Col10047,bl10063.T3 Col10047,
当我试图摆脱 MS Access 时,我将不胜感激有关如何通过 SQL Server 实现此功能的任何想法。