Accessing table and column comments in Oracle for tables in SQL Server via databaselink

655 Views Asked by At

I use an Oracle database, where I have a database-Link to a Microsoft SQL Server database. I need to access the comments for tables in the Microsoft SQL Server database from my Oracle database.

Using the script below I get the values for owner, table_name and column_name, but my comments field is empty (null), although there should be comments.

Why can't I query the comments?

select owner, table_name, table_type, comments
from all_tab_comments@DB_LINK_SQL_SERVER;

select owner, table_name, column_name, comments
from all_col_comments@DB_LINK_SQL_SERVER;
1

There are 1 best solutions below

2
On

ALL_TAB_COMMENTS and ALL_COL_COMMENTS are Oracle views. They have no knowledge of SQL Server tables. You would need to create a view on SQL Server. See Stackoverflow SQL Server: Extract Table Meta-Data (description, fields and their data types) and Accessing table comments in SQL Server