In SQL Server, linked servers allow us to connect to other relational database management systems (RDBMS) and access their data. However, sometimes we may encounter errors when working with linked servers. In this article, we will discuss one such error and its solution.
The OLE DB provider “ASEOLEDB” supplied inconsistent metadata for a column
Recently, a client encountered an error while trying to query a linked server to Sybase. The query they attempted was:
SELECT *
FROM SYBASESERVER.prodxc.dbo.sysobjects
However, this query failed with the following error:
Msg 7356, Level 16, State 1, Line 1
The OLE DB provider "ASEOLEDB" for linked server "SYBASESERVER" supplied inconsistent metadata for a column.
The column "versionts" (compile-time ordinal 20) of object "prodxc.dbo.sysobjects" was reported to have a "DBCOLUMNFLAGS_ISFIXEDLENGTH" of 16 at compile time and 0 at run time.
Upon further investigation, we discovered that the issue seemed to be related to the specific table “sysobjects”. To troubleshoot, we suggested trying the same query with other tables within the system catalog, and surprisingly, those queries executed successfully with no issues.
As a workaround, we recommended using the OPENQUERY format of the linked server query:
SELECT *
FROM OPENQUERY([SYBASESERVER], 'SELECT * FROM PRODXC.DBO.SYSOBJECTS')
This format bypasses the issue and allows the query to execute without errors.
Upon further analysis, we found that the Sybase OLE DB MDA provider on the Sybase server was not up to date. It is crucial to ensure that the drivers on both the client and server sides are up to date to avoid such inconsistencies.
Conclusion
Linked servers in SQL Server provide a convenient way to access data from other RDBMS. However, it is essential to be aware of potential issues that may arise, such as inconsistent metadata errors. By using the OPENQUERY format and ensuring that the drivers are up to date, we can overcome these challenges and continue working with linked servers seamlessly.