Linked SQL Server database giving "inconsistent metadata" error
Asked Answered
C

4

21

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?

Chigoe answered 24/7, 2009 at 18:25 Comment(0)
N
47

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

Nofretete answered 24/7, 2009 at 18:58 Comment(2)
Msg 7356 still happens on OPENQUERY. Just using the function won't helpFire
@TaurusDang it works for my case. Did you find a fix for your issue?Inositol
H
8
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)
Hedwighedwiga answered 24/7, 2009 at 18:45 Comment(0)
M
5

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

Merge answered 12/2, 2015 at 19:31 Comment(1)
Since the question is about a connection to another MS SQL server and not some others DBMS (mySQL, PostgreSQL, ...) this answer is the most valid one for this case (native is way more performant than ODBC). But it will not work if your 2nd server is not a MS SQL serverMenado
D
1

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

Denver answered 4/12, 2023 at 7:17 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.