webCOMAND

#SQL

Executes a SQL query, and stores the results in a variable.  Use #LIST to iterate through the results.

#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.

Prototype

#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.

Example

#SQL($Results,"SELECT Name FROM contenttype_108")
#LIST($Results)
$Name<br />
#ENDLIST

Related

#SQLDB, #LIST, #CPATH, #CQL