Article
· Sep 14, 2023 1m read

How to get all fields of a specified table with SQL

InterSystems FAQ rubric

It can be retrieved using the schema INFORMATION_SCHEMA.

INFORMATION_SCHEMA is a system schema and is not displayed by default in the SQL menu of the Management Portal.

The method to display it is as follows.

  1. Open Management Portal → System Explorer → SQL menu.
  2. Check "System" on the left of the schema drop-down.
  3. Select INFORMATION_SCHEMA from the schema dropdown.

The SQL to get the ID, field name (COLUMN_NAME), data type (DATA_TYPE), description (DESCRIPTION) for the specified table (Sample.Human) is as follows.

SELECT ID,COLUMN_NAME,DATA_TYPE,DESCRIPTION
FROM INFORMATION_SCHEMA.COLUMNS
where TABLE_SCHEMA='Sample' AND TABLE_NAME='Human'
Discussion (0)0
Log in or sign up to continue