MySQL - Execute a query
Use the MySQL - Execute a query action A tool for building the processes, logic, and direction within workflows. Actions are the steps the workflow performs to complete a process. to run queries in a database you specify. A query can be a request for data or for action.
For example, you want to generate a directory of your customers' mobile phone numbers. To achieve this, you need to retrieve the phone numbers from your company database. By using the MySQL - Execute a query, you can retrieve these data, store them in variables, and then insert in a Generate document action.
For more information about MySQL, go to MySQL.
Configure the MySQL - Execute a query action
-
Add the action to the workflow and open the action configuration panel. For more information, see Add an action to the workflow.
- Select a Connection. If you do not have a connection, see Add a connection.
Caution: Make sure to first configure your database's firewall to allow your workflow to connect to your database. For more information on source IP addresses you can use, see Source IP addresses for workflows.
- In SQL script, type concatenated queries, separated by semicolons, to run on your database. Do not use single quotations; instead, for parametrized queries, add query parameter key names and values (next step).
SQL script example: SELECT * FROM [Customers]
- To add a parametrized query execution, in Query parameters, click Add SQL query parameters.
- Add a Parameter name and Value.
- Click Add SQL query parameters to add more parameter names and values.
Example:SELECT * FROM [Customers] WHERE Name = @name
Parameter name = @name
Value = <Customer_Name>
- In Column to retrieve, type the database column that contains the values you want to retrieve. For example, "Email address". This field is required for SELECT queries.
For more guidance on SQL keywords and syntax, see SQL Keywords Reference.
Maintain path integrity
Caution: If a file/folder that's used in a workflow is moved, renamed, or deleted, any workflows that use that file/folder will not start or will fail. Make sure you keep the paths in your workflow configurations up to date.
Source IP addresses for workflows
To run workflows that connect to SQL databases or related systems, first configure its firewall rules to allow traffic from potential source IP addresses for these workflows. If firewall rules are in place but not configured to allow these IP addresses, then contact does not occur and the workflow fails.
For instructions on SQL Server firewall configuration, see the Configure the Windows Firewall to Allow SQL Server Access Microsoft article or, for SQL Server on Windows Azure, see the Creating Microsoft SQL Server Connection to SQL Azure from Nintex Automation CloudNintex Community article.
Potential source IP addresses for workflows:
US region | EU region | AU region |
---|---|---|
|
|
|
MySQL - Execute a query fields and settings
Field |
Description |
Variable types |
---|---|---|
The MySQL connection to use for the query. |
(n/a) |
|
SQL script |
The concatenated queries, separated by semicolons, that will run on your database. Do not use single quotations; instead, for parametrized queries, add query parameter key names and values. SQL script example: SELECT * FROM [Customers] For more guidance on SQL keywords and syntax, see SQL Keywords Reference. |
Text, Decimal, Integer, Boolean, DateTime, Collection |
Query parameters | Adds a parametrized query execution. Click Add SQL query parameters and add a Parameter name and Value. | Text, Decimal, Integer, Boolean, DateTime, Collection |
Column to retrieve | The database column that contains the values you want to retrieve. For example, "Phone numbers". This field is required for SELECT queries. | Text, Decimal, Integer, Boolean, DateTime, Collection |
Result |
Stores the result of the action in an object with the following variables:
This variable is very useful especially if your workflow should know how many values were retrieved by the action. |
Object |