用于检索给定模式的所有表名的 DB2 查询 [英] DB2 Query to retrieve all table names for a given schema

查看:26
本文介绍了用于检索给定模式的所有表名的 DB2 查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是在寻找一个简单的查询来选择给定架构的所有表名.

I'm just looking for a simple query to select all the table names for a given schema.

例如,我们的数据库有超过 100 个表,我需要找到任何包含子字符串CUR"的表.拥有所有表格后,我可以使用 like 命令.

For example, our DB has over 100 tables and I need to find any table that contains the sub-string "CUR". I can use the like command once I have all the tables.

推荐答案

select * from sysibm.systables
where owner = 'SCHEMA'
and name like '%CUR%'
and type = 'T';

这将为您提供 SCHEMA 架构中包含 CUR 的所有表.

This will give you all the tables with CUR in them in the SCHEMA schema.

请参阅此处了解更多信息SYSIBM.SYSTABLES 表的详细信息.如果您看一下左侧的导航窗格,您可以得到各种精彩的 DB2 元数据.

See here for more details on the SYSIBM.SYSTABLES table. If you have a look at the navigation pane on the left, you can get all sorts of wonderful DB2 metatdata.

请注意,此链接适用于大型机 DB2/z.DB2/LUW(Linux/UNIX/Windows 之一)的列略有不同.为此,我相信您想要 CREATOR 列.

Note that this link is for the mainframe DB2/z. DB2/LUW (the Linux/UNIX/Windows one) has slightly different columns. For that, I believe you want the CREATOR column.

在任何情况下,您都应该检查 IBM 文档以了解您的特定变体.几乎可以肯定,表名不会改变,所以只需查找 SYSIBM.SYSTABLES 了解详细信息.

In any case, you should examine the IBM docs for your specific variant. The table name almost certainly won't change however, so just look up SYSIBM.SYSTABLES for the details.

这篇关于用于检索给定模式的所有表名的 DB2 查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆