In SQL Server, we can create linked server to many other RDBMS. The providers to connect would generally publish by destination RBMS. In this client scenario, they were dealing with linked server to Sybase. Let us learn about the error The OLE DB provider “ASEOLEDB” for linked server “SYBASESERVER” supplied inconsistent metadata for a column.
Here is the query which was tried by the client.
SELECT * FROM SYBASESERVER.prodxc.dbo.sysobjects
It was failing with below error
Msg 7356, Level 16, State 1, Line 1
The OLE DB provider “ASEOLEDB” for linked server “ALTAIR” 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.
Linked Server setup was as below:
- Destination Server: Sybase Server: SYBASESERVER:5000
- Provider: SAP ASE OLE DB Provider
To troubleshoot, I asked them to execute the above query by changing the table name with some other tables within the system catalog. Interestingly, we were able to successfully execute those queries with no issues. So, the issue seems to be related to the specific table sysobjects.
Instead of four-part naming, we asked to try below OPENQUERY format of the linked server query.
SELECT * FROM OPENQUERY([SYBASESERVER], 'SELECT * FROM PRODXC.DBO.SYSOBJECTS')
Later we found that It appears that the Sybase OLE DB MDA provider on the Sybase server were not up to date.
- Instead of four-part naming, use OPENQUERY
- Make sure that drivers on the client and server are up-to-date.
Reference: Pinal Dave (https://blog.sqlauthority.com)
Using the example SELECT you cited, I am able to successfully execute that SELECT against the linked server and retrieve data. I then use that SELECT to create a view and when I select from the view, that’s when I get the error message described in this post. I would like to understand why that is. Thank you in advance.