我正在使用一个在SQL Server 2005上运行良好的Openquey,我有一台服务器是SQL Server 2008,但这不起作用。
如果我运行以下内容:
SELECT *
FROM OPENQUERY([Manchester],
'[Manchester].[PilotWebApp].[DBO].rsp_HandheldPerformance ''10/01/2009'',
''10/10/2009''')
我收到此错误:
Cannot process the object "[Manchester].[PilotWebApp].[DBO].rsp_HandheldPerformance '10/01/2009', '10/10/2009'".
The OLE DB provider "SQLNCLI" for linked server "Manchester" indicates that either the object has no columns or the current user does not have permissions on that object.
如果我刚跑:
[Manchester].[PilotWebApp].[DBO].rsp_HandheldPerformance '10/01/2009', '10/10/2009'
它工作正常。 2008年发生了哪些变化?
它的作用是从openquery获取数据并插入我的临时表:
INSERT #TempHandheldPerformance SELECT * FROM OPENQUERY([Manchester], '[Manchester].PilotWebApp.DBO.rsp_HandheldPerformance ''10/01/2009'', ''10/10/2009''')
答案 0 :(得分:8)
即使是2009年的问题,我在2012年遇到了同样的问题!并且有点难以找到答案......无论如何,在执行SP之前只使用了SET NOCOUNT ON
如果曼彻斯特是LinkedServer,那么SET NOCOUNT ON的示例代码应为
SELECT *
FROM OPENQUERY([Manchester],
'SET NOCOUNT ON; EXEC [PilotWebApp].[DBO].rsp_HandheldPerformance ''10/01/2009'',
''10/10/2009''')
并填写我做的临时表
SELECT *
INTO #temptable
FROM OPENQUERY([Manchester],
'SET NOCOUNT ON; EXEC [PilotWebApp].[DBO].rsp_HandheldPerformance ''10/01/2009'',
''10/10/2009''')
答案 1 :(得分:1)
检查并确保遥控器盒上没有名为[Manchester]的链接服务器;您的语法可以解释为:
从本地服务器连接到名为Manchester的链接服务器,然后在另一个名为Manchester的链接服务器上执行存储过程。
斯图
答案 2 :(得分:1)
尝试在查询中添加SET FMTONLY OFF; SET NOCOUNT ON;
SELECT * INTO #temptable FROM OPENQUERY([Manchester], 'SET FMTONLY OFF; SET NOCOUNT ON; EXEC [Manchester]. [PilotWebApp].[DBO].rsp_HandheldPerformance ''10/01/2009'', ''10/10/2009''')
答案 3 :(得分:0)
验证链接服务器是否使用与您相同的凭据。您可以在“链接服务器属性”和“安全选项”中找到它们。