链接的 SQL Server 数据库给出“不一致的元数据” 错误

发布于 2024-07-29 05:18:56 字数 791 浏览 5 评论 0原文

我目前正在运行一个第三方软件套件,它使用 SQL Server 作为数据库。 我有第二个 SQL Server 实例在不同的位置运行,并且我在该实例 SQL Server 中构建的一些应用程序需要访问第三方软件中的一些数据。 因此,我在两个盒子之间创建了一个 ODBC 连接,并在我的 SQL Server 版本上将第三方 SQL Server 设置为链接服务器。 作为测试,我从 SQL 服务器运行了类似以下语句,访问第三方表之一:

SELECT * FROM LinkedServerName.SchemaName.dbo.TableName

我收到此错误:

OLE DB error trace [Non-interface error:  Column 'TableRowVersion' (compile-time
ordinal 4) of object '"SchemaName"."dbo"."TableName"' was reported to have a
DBCOLUMNFLAGS_ISROWVER of 0 at compile time and 512 at run time].

Msg 7356, Level 16, State 1, Line 1

OLE DB provider 'MSDASQL' supplied inconsistent metadata for a column. Metadata
information was changed at execution time.

此错误对于我尝试访问的任何其他表都是相同的。 这个错误是什么意思,有没有解决方法?

I am currently running a third-party software suite, which uses SQL Server as its database. I have a second instance of SQL Server running in a different location, and some apps that I am building in that instance SQL Server needs to access some data in the third-party software. So, I created an ODBC connection between the boxes, and set up the third-party SQL server as a linked server on my version of SQL Server. As a test, I ran something like the following statement from my SQL server, accessing one of the third-party's tables:

SELECT * FROM LinkedServerName.SchemaName.dbo.TableName

To which I recieved this error:

OLE DB error trace [Non-interface error:  Column 'TableRowVersion' (compile-time
ordinal 4) of object '"SchemaName"."dbo"."TableName"' was reported to have a
DBCOLUMNFLAGS_ISROWVER of 0 at compile time and 512 at run time].

Msg 7356, Level 16, State 1, Line 1

OLE DB provider 'MSDASQL' supplied inconsistent metadata for a column. Metadata
information was changed at execution time.

This error is the same for any other table I try to access. What does this error mean, and is there a way around it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

深海夜未眠 2024-08-05 05:18:56

我已经发生过几次这种情况了。 我发现的一种解决方法是使用 OPENQUERY。

SELECT * FROM OPENQUERY(LinkedServerName, 'SELECT * FROM DBName.Schema.Table')

另外,您上面发布的选择有一个不正确的 4 部分名称(可能只是一个拼写错误,但我不确定)。 它应该是LinkedServerName.DBName.SchemaName.TableName

I've had this happen a few times. The one workaround I found was to use OPENQUERY.

SELECT * FROM OPENQUERY(LinkedServerName, 'SELECT * FROM DBName.Schema.Table')

Also, the select you posted above has an incorrect 4 part name (could just be a typo but I wasn't sure). It should be LinkedServerName.DBName.SchemaName.TableName

静若繁花 2024-08-05 05:18:56
Server: Msg 7356, Level 16, State 1, Line 1 

OLE DB provider 'MSDASQL' supplied inconsistent metadata for a column. 
Metadata information was changed at execution time.

如果您使用由四部分组成的名称语法从链接服务器数据库查询数据,您可能会收到此错误消息。 要解决此问题,您可以使用 OPENQUERY 语法从链接服务器数据库查询数据。 您可以打开跟踪标志 7300 以接收有关此错误消息的更多详细信息。 要打开跟踪标志 7300,请运行以下 Transact-SQL 语句:

DBCC TRACEON(7300)
Server: Msg 7356, Level 16, State 1, Line 1 

OLE DB provider 'MSDASQL' supplied inconsistent metadata for a column. 
Metadata information was changed at execution time.

If you use a four-part name syntax to query the data from the linked server database, you may receive this error message. To work around this problem, you can use the OPENQUERY syntax to query the data from the linked server database. You can turn on trace flag 7300 to receive more detailed information about this error message. To turn on trace flag 7300, run the following Transact-SQL statement:

DBCC TRACEON(7300)
撕心裂肺的伤痛 2024-08-05 05:18:56

我通过以下步骤解决了这个问题:

1) 步骤1:

• 在SQL Server Management Studio 中打开链接服务器,然后打开“新建链接服务器”。

• 在出现的向导内部 – 选择“常规”选项卡。

• 在“链接服务器”字段中指定别名。

• 选择SQL Native Client 作为提供程序。

• 在“产品名称”字段中添加sql_server(这就是神奇之处)。

• 在数据源中- 指定要用作链接服务器的主机的名称。

2) 第 2 步:

• 在安全选项卡中 – 指定适当的安全选项(例如安全上下文)

3) 第 3 步:

• 在中服务器选项选项卡 – 将“数据访问”、RPC、“Rpc Out”和“使用远程排序规则”设置为 true。

4) 第 4 步:

• 尽情享受。

http:// alexpinsker.blogspot.com.br/2007/08/how-to-give-alias-to-sql-linked-server.html

I solved this with these steps:

1) Step 1:

• In SQL Server Management Studio open Linked Servers and then 'New Linked Server'.

• Inside of appeared wizard – Select the General tab.

• Specify alias name in "Linked server" field.

• Select SQL Native Client as provider.

• Add sql_server in "Product Name" field (that's the magic).

• In Data Source – specify name of the host to be used as linked server.

2) Step 2:

• In Security tab – specify proper security options (e.g. security context)

3) Step 3:

• In Server Options tab – put "Data Access", RPC, "Rpc Out" and "Use Remote Collation" to be true.

4) Step 4:

• Enjoy.

http://alexpinsker.blogspot.com.br/2007/08/how-to-give-alias-to-sql-linked-server.html

忆依然 2024-08-05 05:18:56

尽管这个问题很老了,但当人们使用链接服务器时,它还是很常见的。 这就是我解决此问题的方法(如您所见,特定列似乎造成了问题)

  1. 在 SSMS 中将服务器添加为链接服务器并使用您指定的别名
  2. 使用 OpenQuery
  3. 不要使用星号 (*) 符号。 .. 命名您真正需要的列

这通常可以解决问题

Although the question is old, it is somewhat common when one is working with linked servers. This is how I solved this problem (As you can see, a specific column seems to have created the problem)

  1. Add the server as linked server in SSMS and use the alias you have specified
  2. Use OpenQuery
  3. Do not use the Asterisk (*) sign... Name the columns you really need

This normally solves the problem

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文