602SQL Documentation Index  

_IV_TABLE_COLUMNS and _IV_VIEWED_TABLE_COLUMNS System Queries

The system queries _iv_table_columns and _iv_viewed_table_columns contain one row for each column of a table or stored query on the server. The DELETED column is not displayed, but the hidden system columns (beginning with _W5_) are displayed.

These columns are displayed in the result:

Column name Type Contents
Schema_name CHAR(31) Name of the schema the table belongs
Table_name CHAR(31) Name of the table or query the column belongs
Column_name CHAR(31) Name of the column
Ordinal_position INT Ordinal number of the column in the table or in the query result (beginning with 1)
Data_type INT The column type (from the data types table)
Length INT The maximum length of a value in the column (in bytes), defined for character, binary strings and CHAR (NOTE: UNICODE strings are twice the size)
Precision INT Number of decimal digits (defined for NUMERIC and DECIMAL types)
Default_value CLOB The default value (only for tables)
Is_nullable BOOLEAN A flag specifying whether the column may have NULL values
Value_count INT Not used in the current version
Expandable BOOLEAN Not used in the current version
Wide_char BOOLEAN A flag specifying whether a character string is UNICODE
Ignore_case BOOLEAN A flag specifying whether sorting is case-sensitive
Collation_name CHAR(20) Name of the national sorting method
With_time_zone BOOLEAN A time value is stored in the UTC format and is transferable between time zones
Domain_name CHAR(31) Name of the domain specifying the column type (empty if the type is not defined in the domain, for tables only)
Hint_caption CHAR(31) The column description
Hint_helptext CLOB The help text
Hint_codebook CLOB The name of the fixed query (or SELECT) whose values are used for the predefined combo box
Hint_codetext CHAR(31) Name of the column from the previous query that represents the text combo box selection
Hint_codeval CHAR(31) Name of the column from the previous query that contains the value
Hint_oleserver CLOB Not used in the current version

The result of this query may be very large. It is recommended to restrict it with appropriate conditions on tables or queries using the WHERE clause.

Example:

This query displays the names of all columns from the Possibilities table in the Inquiry application.

SELECT Column_name, Data_type
FROM  _iv_table_columns
WHERE schema_name = 'Inquiry'  AND table_name = 'Possibilities'