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;
1

1 Answer

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

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article
Twitter Facebook Pinterest