#SQL
#SQL provides access to data stored in SQL databases, including the one underlying a COMAND repository. Unless low-level access to a COMAND repository is required, #CPATH or #CQL should be used to query a COMAND repository instead.
Syntax
#SQL(Variable,Query)
Parameters
- Variable - The variable to store the SQL query results in. The variable name should include the preceding dollar sign.
- Query - A string or variable with the SQL query.
Description
Executes a SQL query, and stores the results in a variable. Use #LIST to iterate through the results.
Related: #SQLDB, #LIST, #CPATH, #CQL
Example
#SQL($Results,"SELECT Name FROM contenttype_108")
#LIST($Results)
$Name<br />
#ENDLIST
Result
Assuming a Contact Content Type has an ID of 108, the example above would produce the following output.
John Smith<br />
Mary Joe<br />