简体   繁体   English

链接服务器的OLE DB提供程序为列提供了不一致的元数据

[英]The OLE DB provider for linked server supplied inconsistent metadata for a column

The error I get is: 我得到的错误是:

The column "EngDescAlt" (compile-time ordinal 2) of object "select * from MstBusiness" was reported to have a "DBCOLUMNFLAGS_ISLONG" of 128 at compile time and 0 at run time.

I get the same error for various columns in a couple of tables, the only difference each time is the column name and the table name, and I cant figure out how to fix it. 我在几个表中的各个列中得到相同的错误,每次唯一的区别是列名和表名,我无法弄清楚如何修复它。 Any ideas? 有任何想法吗?

Just by the way using OpenQuery doesnt work as that is what I was already using. 就像使用OpenQuery的方式不起作用,因为这是我已经使用的。

Any help is appreciated. 任何帮助表示赞赏。

SELECT     Z_ID AS BusinessID, EngDescAlt AS Description
FROM         OPENQUERY(<LinkedServer>, 'select * from <Tablename>') AS U2_<Tablename>

For some reason restarting MS SQL SERVICES on the server fixed the problem. 由于某种原因,在服务器上重新启动MS SQL SERVICES修复了问题。 It seems it had something to do with a problem that was fixed and required a restart to enact. 它似乎与修复的问题有关,需要重新启动才能实现。 Sorry I cant be more specific as to what fixed the problem. 对不起,我不能更具体地解决问题的原因。

I just noticed you edited your question, posting your query. 我刚注意到你编辑了你的问题,发布了你的查询。
A great way to debug, is to test small steps toward your goal... so you can see exactly which step introduces an error. 调试的一个好方法是测试朝向目标的小步骤......这样您就可以确切地看到哪个步骤引入了错误。

First, can you connect directly to the target server, to test your queries without OPENQUERY? 首先,您可以直接连接到目标服务器,在没有OPENQUERY的情况下测试您的查询吗?
If so, then try the simple select from within SSMS (SQL Server Management Studio): 如果是这样,那么尝试从SSMS(SQL Server Management Studio)中进行简单选择:

SELECT Z_ID AS BusinessID, EngDescAlt AS Description  
FROM <Tablename>

If that works, try: 如果有效,请尝试:

SELECT Z_ID AS BusinessID, EngDescAlt AS Description 
FROM (select * from <Tablename>) AS U2_<Tablename>

And try running the openquery in SSMS, in a query window that is connected directly to that target server (rather than as a linked server): 并尝试在SSMS中运行openquery,在一个直接连接到该目标服务器(而不是链接服务器)的查询窗口中:

SELECT Z_ID AS BusinessID, EngDescAlt AS Description
FROM OPENQUERY(<LinkedServer>, 'select * from <Tablename>') AS U2_<Tablename>

Finally, a question: what environment have you been running the OPENQUERY in? 最后,一个问题:您在哪个环境中运行OPENQUERY? Has it been from within SSMS on another server / your workstation? 它是否来自SSMS内的另一台服务器/您的工作站? Or has it been from some other environment/language/tool? 或者是来自其他环境/语言/工具? If you haven't been executing the openquery in SSMS, try that too, accessing as a linked server. 如果您还没有在SSMS中执行openquery,请尝试访问作为链接服务器。

And please report back the results and/or messages. 请报告结果和/或消息。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 链接服务器的OLe数据库提供程序“SQLNCLI”无法启动分布式事务 - OLe DB provider “SQLNCLI” for linked server was unable to begin a distributed transaction 链接服务器“(null)”的OLE DB提供程序“ MSDASQL”报告错误 - The OLE DB provider “MSDASQL” for linked server “(null)” reported an error 链接服务器无法初始化 OLE DB 提供程序的数据源对象 - Linked server Cannot initialize the data source object of OLE DB provider 链接服务器的OLE DB提供程序报告了架构版本错误 - OLE DB provider for linked server reported a change in schema version Error 无法从链接服务器的OLE DB提供程序“ MSDASQL”获取列“ [MSDASQL] .LONG_DESCRIPTION”的当前行值:-NETSUITE - Cannot get the current row value of column “[MSDASQL].LONG_DESCRIPTION” from OLE DB provider “MSDASQL” for linked server :--NETSUITE 链接服务器“(null)”的 OLE DB 提供程序“MSDASQL”无法更新表“[MSDASQL]”。 Pervasive 的未知提供程序错误 - The OLE DB provider "MSDASQL" for linked server "(null)" could not UPDATE table "[MSDASQL]". Unknown provider error with Pervasive 无法为链接服务器初始化OLE DB提供程序“ Microsoft.ACE.OLEDB.12.0”的数据源对象 - Cannot initialize the data source object of OLE DB provider “Microsoft.ACE.OLEDB.12.0” for linked server 链接服务器[ORA]的OLE DB提供程序[OraOLEDB.Oracle]返回了消息ORA-00936:缺少表达式 - OLE DB provider [OraOLEDB.Oracle] for linked server [ORA] returned message ORA-00936: missing expression 错误:无法从OLE DB提供程序“ADsDSOObject”获取链接服务器“ADSI”的行 - Error : Cannot fetch a row from OLE DB provider “ADsDSOObject” for linked server “ADSI” 链接服务器“(null)”的 OLE DB 提供程序“Microsoft.ACE.OLEDB.12.0” - The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM