'Accessing table and column comments in Oracle for tables in SQL Server via databaselink
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;
Solution 1:[1]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Brian Leach |
