HANA 列表/显示表 SQL 命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41727670/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
HANA list / show tables SQL Command
提问by Thorsten Niehues
How to show / list all tables in SAP HANA via SQL?
如何通过 SQL 显示/列出 SAP HANA 中的所有表?
回答by Lars Br.
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.
SAP HANA 通过TABLES、 VIEWS 、 USERS 等系统表提供数据库目录(就像大多数其他 DBMS 一样)......这些是符合 ANSI-92 的元数据视图。
Instead of the INFORMATION_SCHEMASAP HANA provides these views in the PUBLICschema (again, like other DBMS do that).
SAP HANA代替INFORMATION_SCHEMA在PUBLIC模式中提供这些视图(同样,就像其他 DBMS 那样)。
Example:
例子:
select * from tables
select * from public.tables
The M_TABLES provides information about the runtime objects that represent tables.
M_TABLES 提供有关表示表的运行时对象的信息。
回答by Alferd Nobel
To view tables from a specific schema :
从特定模式查看表:
select * from SYS.M_TABLES where SCHEMA_NAME ='<your schema name goes here>'
回答by Janusz
SELECT TABLE_NAME FROM SYS.M_TABLES
回答by snow_FFFFFF
It is my understanding that HANA is compatible with ANSI SQL. If this is actually the case, the following should work:
据我了解,HANA 与 ANSI SQL 兼容。如果确实如此,则以下操作应该有效:
SELECT * FROM INFORMATION_SCHEMA.TABLES
Of course, I don't have access to a hana instance to prove this.
当然,我无法访问 hana 实例来证明这一点。
CORRECTION: After looking at some documentation, it looks like SAP supports this type of thing through a SYS schema:
更正:查看一些文档后,看起来 SAP 通过 SYS 架构支持这种类型的事情:
So, I think you would actually select from:
所以,我认为你实际上会选择:
SYS.M_TABLES