延迟准备无法完成,3 SQL 服务器

deferred prepare could not be completed, 3 SQL Servers

我有 3 个 SQL 服务器,我在使用 OpenRowset 时遇到了奇怪的行为。

鉴于:

SQL:

SELECT a.* 
FROM OPENROWSET('SQLOLEDB', 
                'Data Source=192.168.1.1;Persist Security 
Info=True;uid=sa;pwd=password',  
                'SELECT * FROM  dfs_database.dbo.dfs_vehicledata ') AS a; 

这是奇怪的部分:如果我在服务器 .3 和 .4 上 运行 上述 SQL 语句,一切正常。

但是,如果我 运行 服务器 .2 上的 SQL 语句,我得到:

OLE DB provider "SQLNCLI11" for linked server "(null)" returned message "Deferred prepare could not be completed.".

Msg 8180, Level 16, State 1, Line 7
Statement(s) could not be prepared.

Msg 208, Level 16, State 1, Line 7
Invalid object name 'dfs_database.dbo.dfs_vehicledata'.

那么,当其他关系正常时,什么会导致一种关系不正常呢?有任何想法吗?它们都是 SQL 服务器快递,并且所有报告都有 SQLNCLI11 提供商。

使用 OpenRowSet 看起来像这样:

sp_configure 'Show Advanced Options', 1
GO
RECONFIGURE
GO
sp_configure 'Ad Hoc Distributed Queries', 1
GO
RECONFIGURE
GO
OPENROWSET('SQLNCLI', 
'Server=ipHere\ExtentionNameifHas;Database=DBName;Uid=userName;PWD=Password;'
,'SET FMTONLY OFF;SET NOCOUNT ON;SELECT * FROM  
dfs_database.dbo.dfs_vehicledata'

从错误日志尝试将 OLE DB 提供程序名称从 'SQLOLEDB' 更改为 'SQLNCLI11',并且 检查对象的位置。确保提供数据库的完整位置,table 等