[英]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.