SQLCommandColumnCount Function

Help Contents


The SQLCommandColumnCount function returns the number of columns in a SQLCommand Data Object.


Informal Syntax:

SQLCommandColumnCount( CommandID )

Formal Syntax:

        CommandID:=Expression )


The SQLCommandColumnCount Function has these parameters:

Parameter Type Description
CommandID UDINT The identifier of the SQLCommand Data Object.

Return Value

The function returns a UDINT value indicating the number of columns associated with an SQLCommand Data Object.

The meaning of the return value depends on the type of SQL Command executed:

SQL CommandReturn Value
SELECT Statement The number of columns in the result set
INSERT Statement The function returns zero
UPDATE Statement The function returns zero
DELETE Statement The function returns zero


The function should only be called when the CommandID parameter refers to a valid SQLCommand Data Object.


For examples see the Examples section of the SQLCommandFromTagDB Function Block.

Standards Compliance

The SQLCommandColumnCount Function is an extension to the IEC 61131-3 standard.

Further Information

SQLCommand Data Object

To learn how to use the SQLCommand data object.

Data Objects

To learn how to use data objects in IEC 61131-3 code.

IEC 61131-3

To learn how IEC 61131-3 is used in Fernhill SCADA.


For the meaning of terms used in Fernhill SCADA.