How to show / list all tables in SAP HANA via SQL?
5 Answers
SAP HANA provides a database catalog (just like most other DBMS) via system tables like TABLES, VIEWS, USERS, etc. ... These are the ANSI-92 compliant metadata views.
Instead of the INFORMATION_SCHEMA SAP HANA provides these views in the PUBLIC schema (again, like other DBMS do that).
Example:
select * from tables
select * from public.tables
The M_TABLES provides information about the runtime objects that represent tables.

- 13,712
- 22
- 78
- 113

- 9,949
- 2
- 15
- 29
-
1Downvote because of what? The answer I provided is accurate and complete. – Lars Br. Jan 19 '17 at 11:40
-
2TABLES and the other metadata views are VIEWS in schema SYS, and at the same time PUBLIC SYNONYMS (in schema PUBLIC). But this should be no reason at all for a downvote! Whoever downvoted should at least provide a better answer or comment. – Christoph G Jan 20 '17 at 08:07
-
1`M_TABLES` is a system view that provides **runtime information** on tables - it's not the primary catalog view to query for tables. For example, it does not include *virtual tables*, where `TABLES` does. – Lars Br. Feb 12 '19 at 23:26
To view tables from a specific schema :
select * from SYS.M_TABLES where SCHEMA_NAME ='<your schema name goes here>'

- 3,185
- 2
- 30
- 35
This below query will list all your schema tables
select * from tables where SCHEMA_NAME ='schema_name'

- 253
- 4
- 14
It is my understanding that HANA is compatible with ANSI SQL. If this is actually the case, the following should work:
SELECT * FROM INFORMATION_SCHEMA.TABLES
Of course, I don't have access to a hana instance to prove this.
CORRECTION: After looking at some documentation, it looks like SAP supports this type of thing through a SYS schema:
So, I think you would actually select from:
SYS.M_TABLES

- 3,235
- 17
- 29
-
M_TABLES is not providing information on all tables in the database, but runtime information on ROW- and COLUMNstore information. – Lars Br. Jan 18 '17 at 22:51