Automation Engine Script Guide > AE JCL for SQL > SQL_GET_COLUMNS

SQL_GET_COLUMNS

Supplies information about a table's columns.

Syntax

SQL_GET_COLUMNS TABLE=...

Syntax

Description/Format

TABLE=

Name of the table.

Comments

The agent writes the result to a report. Exactly one line is output per column with the individual values being separated by semicolons.

Structure of the information given in a column:

Foreign key;primary key;column name;(data type)

Value

Description

Foreign key

Indicator for the key.

Allowed values: 0 and 1
0 - The column is not a foreign key.
1 - The column is a foreign key.

Primary key

Indicator for the key.

Allowed values: 0 and 1
0 - The column is not a foreign key.
1 - The column is a foreign key.

Column name

Name of the column.

Data type

This is a combination of the vendor's data type and the information whether or not this field permits value NULL. For character types, the length is shown enclosed in parentheses after the data type.

A COMMIT is automatically made before this script function is processed.

Examples

The following call retrieves column information of the Products table.

SQL_GET_COLUMNS TABLE="Products";

Result in the report:

0;1;ProductID;(int identity, not null)
0;0;ProductName;(nvarchar(40), not null)
1;0;SupplierID;(int, null)
1;0;CategoryID;(int, null)
0;0;QuantityPerUnit;(nvarchar(20), null)
0;0;UnitPrice;(money, null)
0;0;UnitsInStock;(smallint, null)
0;0;UnitsOnOrder;(smallint, null)
0;0;ReorderLevel;(smallint, null)
0;0;Discontinued;(bit, not null)

 

See also: