Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linked SQL Server database giving "inconsistent metadata" error

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?

like image 481
dpmattingly Avatar asked Jul 24 '09 18:07

dpmattingly


People also ask

How do I edit a linked server in SQL?

In SQL Server management Studio click right on the linked server, choose "Script Linked Server as' then choose 'DROP and CREATE to' and then "New Query Editor Window'. You can now adjust any settings that you want to adjust in the script and then run it. The existing linked server will be dropped and a new one created.

Why are linked server queries so bad?

Problem #2: linked servers don't cache data. Even worse, it penalizes both servers involved with the linked server query. It's hard on the local server, and it's hard on the remote server that holds the single source of truth for the table.

Can not initialize the data source object of OLE DB provider?

It means you need to create the same user name and password on your two servers if you use one sql server authentication. If the answer is helpful, please click "Accept Answer" and upvote it.

How do I create a linked server in SQL Server postgresql?

Create Linked ServerOpen SQL Server management studio 🡪 Connect to SQL Server instance 🡪 In object explorer, expand Server Objects 🡪 Right-click on Linked Server and select New Linked Server. A dialog box New Linked Server opens. To configure the linked server, specify the following details on the General page.


2 Answers

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

like image 98
BrianD Avatar answered Sep 28 '22 04:09

BrianD


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)
like image 28
Raj Avatar answered Sep 28 '22 06:09

Raj