If you call IDBSchemaRowset::GetRowset using SQLOLEDB and a Server cursor (using DBPROP_SERVERCURSOR), you may receive an incorrect Table Catalog name.
↑ Back to the top
You can work around this problem by not using a server cursor if you are going to use the Table Catalog information in your application.
This problem only affects the Table Catalog information. All other information returned by IDBSchemaRowset will be from the requested database regardless of cursor location.
↑ Back to the top
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
↑ Back to the top
Steps to Reproduce Behavior
- Using RowsetViewer, establish an OLEDB session with SQL Server. Make sure that the current catalog for that session is the master database.
- Invoke the IDBSchemaRowset::GetRowset function from the Session menu.
-
Select rguidSchema = DBSCHEMA_TABLES from the drop down list.
- Type "pubs" in the TABLE_CATALOG field.
- Click Properties.
- Set DBPROP_SERVERCURSOR to TRUE.
-
Make sure that Use restriction and use properties are selected.
The resultset will contain information from the pubs database but the TABLE_CATALOG column will show "master".
↑ Back to the top