This type of action is used to execute SQL query for each incoming message.
You should select a database for the query execution. Press the Connect DB... button to do it with the standard ODBC connection setup dialog; you may also enter ODBC connection string or data source name by hand (into the yellow entry field near this button).
The following parameters are supported:
- SQL statement. It may be the statement of any kind, e.g. SELECT, INSERT, UPDATE, DELETE, stored procedure call (if your database supports stored procedures)... You may use variable references in this statement, but there is a special thing you should be aware of: the variables are not substituted into the query, they are passed to the database driver as query parameters instead. So, the following variable references are invalid:
- SELECT * FROM [%word#1%] — Don't do it!
- [%Message%] FROM MyTable — Don't do it!
- Expected result format. If you want the query result to be stored in one or more variables, you must specify what kind of data the query is expected to return. Choose one of the following:
- The number of updated rows. This kind of result is for INSERT, UPDATE and DELETE queries. The target variable will contain the number of rows that were affected by this query.
- One selected record. This kind of result is for SELECT queries that are expected to return exactly one row. In this case there may be several variables that will get the query result: the first variable is set from the first column of the row returned, and so on.
- One-column result (as a list). This kind of result is for SELECT queries that return one column of data (and any number of rows). The data from all rows will be stored in the target variable, separated by spaces.
- Store the query result to variable(s): the name of the target variable, or several names separated by spaces (the result format must be One selected record in the latter case).