on 2022 Jul 08 12:24 PM
We need to find out, which columns a given synonym provides via HANA SQL.
HANA provides views for table_columns, view_columns, but there is nothing like synonym_columns.
What is the official SQL way in HANA to get the list of columns for a given synonym?
P.S: I have some doubts of checking to which HANA table or view a synonym refers to and then read the column information from the original artifact, because the whole point of synonyms is to hide the original object behind and make it exchangable.
You can run statement like this
SELECT
B."SCHEMA_NAME",
B."SYNONYM_NAME",
A."SCHEMA_NAME",
A."TABLE_NAME",
A."COLUMN_NAME"
FROM
"SYS"."TABLE_COLUMNS" AS A
INNER JOIN
"SYS"."SYNONYMS" AS B
ON B."OBJECT_SCHEMA" = A."SCHEMA_NAME"
AND B."OBJECT_NAME" = A."TABLE_NAME"
WHERE "SYNONYM_NAME" = '<YOUR_SYNONYM>';
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
74 | |
10 | |
8 | |
8 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.