SQL_GET_COLUMNS

Use the SQL_GET_COLUMNS script element to retrieve information about the columns of a table. The agent writes the result to a report, with one line per column and the individual values separated by semicolons.

Important! A COMMIT is performed automatically before this script element is processed.

Syntax

SQL_GET_COLUMNS TABLE=...

Parameters

Parameter Description Format
TABLE= Name of the table Script literal

Output Format

The agent writes one line per column to the report. Each line has the following structure, with values separated by semicolons:

Foreign key;Primary key;Column name;(Data type)

Field Description Allowed Values
Foreign key Indicates whether the column is a foreign key
  • 0 — The column is not a foreign key

  • 1 — The column is a foreign key

Primary key Indicates whether the column is a primary key
  • 0 — The column is not a primary key

  • 1 — The column is a primary key

Column name The name of the column n.a.
Data type

(Optional)

The vendor's data type, plus whether the field permits NULL. For character types, the length is shown in parentheses after the data type. n.a.

Examples

The following call retrieves column information for 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: