我正在尝试从 SQL Server 访问存储在 MySQL 上的数据。我已按照本网站 http://www.sqlservercentral.com/Forums/Topic340912-146-1.aspx上的说明进行操作
我创建了没有问题的链接服务器,但是当我尝试使用 OPENQUERY 选择数据时,出现以下错误
Msg 7357, Level 16, State 2, Line 1
Cannot process the object "
SELECT
CAST(t.name AS CHAR) AS team_name,
CAST(TRIM(REPLACE(CONCAT(su.first_name, " ", su.middle_name , " ", su.last_name), " ", " ")) AS CHAR) AS fullname,
CAST(su.login_user AS CHAR) AS username,
CAST(t.billing_department_id AS UNSIGNED) AS billing_dept_id
FROM my_table.users AS su
INNER JOIN my_table.teams AS t ON t.team_id = su.team_id
WHERE client_id = 1 ". The OLE DB provider "MSDASQL" for linked server "SQLSERVER_1" indicates that either the object has no columns or the current user does not have permissions on that object.
这是我的查询
SELECT * FROM OPENQUERY(SQLSERVER_1, '
SELECT
CAST(t.name AS CHAR) AS team_name,
CAST(TRIM(REPLACE(CONCAT(su.first_name, " ", su.middle_name , " ", su.last_name), " ", " ")) AS CHAR) AS fullname,
CAST(su.login_user AS CHAR) AS username,
CAST(t.billing_department_id AS UNSIGNED) AS billing_dept_id
FROM my_table.users AS su
INNER JOIN my_table.teams AS t ON t.team_id = su.team_id
WHERE client_id = 1 ') AS su
有人能告诉我这有什么问题吗,我能做些什么来解决这个错误?
谢谢