我使用的Openquey在SQL Server2005上运行良好,我有一台服务器是SQL Server2008,但它不能在上面工作。
如果我运行以下命令:
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''')发布于 2012-01-30 16:21:01
即使是2009年的问题,我在2012年也遇到了同样的问题!在执行SP之前,很难找到刚刚使用的answer....anyway 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''')发布于 2009-10-28 02:46:56
检查并确保远程计算机上没有名为曼彻斯特的链接服务器;您的语法可以解释为:
从本地服务器连接到名为曼彻斯特的链接服务器,然后在另一个名为曼彻斯特的链接服务器上执行存储的proc。
Stu
发布于 2015-07-30 02:33:01
尝试在查询中添加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''')https://stackoverflow.com/questions/1625055
复制相似问题