Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
janus2021
Creator
Creator

Extract the comments on a table column.

Hi All,

is there is a way to extract the comments on a table column.

Example: I want to extract this from an Oracle table: MY_TABLE

COLUMN_NAME | DATA_TYPE | NULLABLE | COLUMN_ID | COMMENT

My_Col1| NUMBER | Yes | 1 | Comment on Col1!

My_Col2| NUMBER | Yes | 2 | Comment on Col2!

 

So in my Load i want to get the comment:

LIB Connect to 'DataSource';

[MY_TABLE_comments]:
SELECT  "My_Col1",
"My_Col2",
"comment_My_Col1" ???
FROM "SCHEMA"."MY_TABLE";

 

BR

J

 

Labels (1)
1 Solution

Accepted Solutions
marcus_sommer

The normal tables contain just data. If you want to get the meta-data to them you will need to query the data-base system-tables. You may need some extra access rights for it and you should know how the system-tables are organized. I suggest you asked the data-base admins and/or the community from the data-base to get a how-to.

View solution in original post

8 Replies
Braveen
Contributor III
Contributor III

I don't follow your question. What do you mean by extract comments from the column?

In your SQL script, you have used "My_Col1", "My_Col2". But, in your sample table, there are no columns as "My_Col1", "My_Col2".

Can you show the sample output and a sample data?

SELECT  "My_Col1",
"My_Col2",
"comment_My_Col1" ???
FROM "SCHEMA"."MY_TABLE";

  

marcus_sommer

The normal tables contain just data. If you want to get the meta-data to them you will need to query the data-base system-tables. You may need some extra access rights for it and you should know how the system-tables are organized. I suggest you asked the data-base admins and/or the community from the data-base to get a how-to.

janus2021
Creator
Creator
Author

I have a Oracle table and on some columns have comments.

This LOAD in Qlik:

[MY_TABLE_comments]:
SELECT "My_Col1",
"My_Col2",
FROM MY_TABLE;

 

This load will only give back the selected columns and the values. But i  also want to get the colum comments.
Is it possible, to get: My_Col1.COMMENT and not only the value in My_Col1?

 

Is it more clear what i asking?

janus2021
Creator
Creator
Author

yes, i can get info from: dba_col_comments but did hope that i could do it from the normal Load.

Thanks

J

PrashantSangle

Can explain your query with sample data.. difficult to understand your query.

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
janus2021
Creator
Creator
Author

Hi.

connect to the schema or user that has privilige to read som dba views. Than you can Load comments like:

LIB CONNECT TO 'SCHEMA_THAT_CAN_READ_DBA_VIEWS';

[MY_TABLE_COMMENT]:
LOAD *;

SELECT table_name,
column_name,
comments
FROM dba_col_comments
WHERE table_name='MY_TABLE';


//Or if you want to get comments from all tables.
[YOUR_SCHEMA_COMMENT_ON_ALL_TABLES]:
LOAD *;

SELECT table_name,
column_name,
comments
FROM dba_col_comments
WHERE OWNER='YOUR_SCHEMA_NAME';

 

Is this clear?

marcus_sommer

AFAIK it's not possible against the data-tables. But the access to the wanted meta-data might be simplified respectively outsourced within n specialized queries/views within the data-base itself - and you queries then this one.

janus2021
Creator
Creator
Author

I can use above Qlik code and get response from our oracle database. Both via the Sql tool Toad and via loading in Qlik.