{{tag>Action Action_List Process SQL Query Version:v8.4}} ====== EXEC_SQL ====== This action executes the specified SQL string by invoking the database engine. ===== Syntax ===== ''EXEC_SQL'' ArithmeticExpression ()[ ''OF'' ] [ RETURN Id() ] where ArithmeticExpression defines a string to be executed, for example: EXEC_SQL `UPDATE CRM_Customer SET Name='John'` **note** An SQL statement that returns nothing (''UPDATE'', ''INSERT'', ''DELETE'') must still end with ''RETURN'' and the name of any business object, or the action fails with "Internal Error". The object is not used. For example: EXEC_SQL `UPDATE CRM_Customer SET Name='John'` RETURN CRM_Customer If SQL to be executed performs a SELECT specify the object name that the SQL returns. ===== Example ===== EXEC_SQL `SELECT * FROM CRM_Customer WHERE FirstName='Jane'` RETURN Customer You have to be careful when using this action as you can stuff up your database if you do something wrong. This action is only recommended for advanced users who understand how AwareIM manages the database. The identifier after ''OF'' can be used to identify a particular database environment, defined when connecting AwareIM to external databases. If not present the native AwareIM database is used **note** In the example above Customer is a virtualised object and can be viewed but cannot be brought into context to interact with it. ===== Related ===== [[ref:a_f:a:exec_sp|EXEC_SP]], [[ref:a_f:a:exec_string|EXEC_STRING]]