Written by

Senior Startups and Community Programs Manager at InterSystems Corporation
Question Evgeny Shvarov · Apr 3, 2023

How to list all the tables available in a current database?

Hi developers!

What is the way using SQL to list all the tables available in the current database/namespace?

Product version: IRIS 2022.3

Comments

Dmitry Maslennikov · Apr 3, 2023

You can do this query

SELECT TABLE_SCHEMA, TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES                   
WHERE TABLE_TYPE='BASE TABLE'

Filter by TABLE_TYPE is to get rid of system tables

0
Muhammad Waseem · Apr 3, 2023

Hi @Evgeny Shvarov,
List of Tables can be listed by using the below query against all or specific schema:

SELECT TOP 5 * FROM INFORMATION_SCHEMA.TABLES
--WHERE TABLE_NAME LIKE '%CSP%'


While Columns details can be listed by using the below query:

SELECT TOP 5 * FROM INFORMATION_SCHEMA.COLUMNS
--WHERE TABLE_NAME LIKE '%CSP%'--AND TABLE_SCHEMA LIKE '%CSP%'

Thanks

0
Daniel Kutac · Apr 4, 2023

call %Library.SQLCatalog_SQLTables()

how about this?

0