SQL_GET_COLUMNS

The SQL_GET_COLUMNS script element supplies information about the columns of a table. The agent writes the result to a report. Exactly one line is output per column with the individual values being separated by semicolons.

Important! A COMMIT is automatically done before this script function is processed.

Syntax

SQL_GET_COLUMNS

TABLE=...

Parameters

  • SQL_GET_COLUMNS
    Supplies information about the columns of a table

  • TABLE=
    Name of the table

Structure of the information provided in a column:

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

  • Foreign key
    Indicates the key
    Allowed values:

    • 0
      The column is not a foreign key
    • 1
      The column is a foreign key
  • Primary key
    Indicates the key
    Allowed values:

    • 0
      The column is not a foreign key
    • 1
      The column is a foreign key
  • Column name
    The name of the column

  • Data type
    (Optional) This value is composed of the data type of the vendor, and the information whether this field permits the value NULL. For character types, the length is shown enclosed in parentheses after the data type.

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: