Friday, March 08, 2013

MSSQL Linked Server error: The OLE DB provider "OraOLEDB.Oracle" for linked server supplied inconsistent metadata for a column


I was trying to pull data from Oracle to MSSqlserver database using Linked server.

select * from [LINK_NAME]..SCOTT.DESCRIPTION;

But it was failing with the below error:

Msg 7356, Level 16, State 1, Line 1
The OLE DB provider "OraOLEDB.Oracle" for linked server "LINK_NAME" supplied inconsistent metadata for a column. The column "MANUFACTURER_NAME" (compile-time ordinal 6) of object ""SCOTT"."DESCRIPTION"" was reported to have a "LENGTH" of 100 at compile time and 200 at run time.

Not quite sure about the column metadata inconsistency the error reported. But got the following workaround using OPENQUERY option.

Here’s how it worked.
Select * from OPENQUERY(LINK_NAME,’SELECT * FROM SCOTT.DESCRIPTION’);

No comments: