Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Check existence and get names of columns of an arbitrary HANA data source (table, view, analytical view, ...)

$
0
0

Hi all,

 

I am building an application where the data source for the application logic can be an arbitrary HANA data source, for example a column store table, a view, an analytical view, ...

 

I would like to find out programmatically

 

1) whether the data source exists (I know its schema and name but not the kind of data source, i.e. whether it is a table, a view, an analytical view, ....)

 

2) which columns the data source exposes to be used in SELECT statements.

 

I know, of course, about some HANA system views where I can find these info for specific data sources, for example for tables. However, how to do this in a more generic way?

 

I am thinking about using the following SQL statement:

 

SELECT * FROM <data source> WHERE 1=2

 

which should give a result set consisting of empty columns from which I can see the column names of the data source.

If the execution of this statement fails this would be a hint that the data source itself does not exist.

 

Will this work for all kind of data sources?

Any recommendations for an alternative approach?

 

Best regards, Hans-Georg


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>