PercivalPersephi
PercivalPersephi

Reputation: 1

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;

Upvotes: 0

Views: 949

Answers (1)

Brian Leach
Brian Leach

Reputation: 2101

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

Upvotes: 0

Related Questions