SQL

SQL is used to retrieve a value from the database using a query. The SQL statement should be constructed to return one value. If the results have more than one column and/or more than one row, only the first column of the first row is fetched. The SQL query can have dynamic items within its construct.  These items take the form of [VariableName].  VariableName can also include system provided variables like PolicyGUID and SegmentGUID. 

SQL: Elements and Attributes
TYPE=SQL
 Element Attributes Parent Element Description Element/Attribute Value

<MathVariable>

TYPE

   

A SELECT statement.
SQL

 

LOG

   

Yes: the result is stored in AsActivityMath table to be used by other activities. 

No: result is not stored. This is the default behavior. 

 

DEFAULT

   

Best practice is to make your default value a value that will indicate you did not retrieve data as expected. Useful for debugging. Must be defined when the datatype of the SQL is integer or decimal.

CLEARVALUE

  Optional Element

Value: Yes / No

Default Value: No

Yes: The value of the math variable will be deleted after the execution of all the Attached Rules at the end of activity processing and will not be visible on the Math tab in the Activity details screen.

No: The value of the math variable will be retained after activity processing and will be displayed in the Math tab in the Activity details screen.

XML Example

<MathVariable VARIABLENAME="RoleGUID" TYPE="SQL" DATATYPE="TEXT">SELECT AsRole.RoleGUID FROM AsRole</MathVariable>