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.
- Open Management Portal → System Explorer → SQL menu.
- Check "System" on the left of the schema drop-down.
- Select INFORMATION_SCHEMA from the schema dropdown.
.png)
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.
SELECTID,COLUMN_NAME,DATA_TYPE,DESCRIPTION
FROM INFORMATION_SCHEMA.COLUMNS
where TABLE_SCHEMA='Sample'AND TABLE_NAME='Human'Discussion (0)0