# Wait for SQL

### Description

The `Wait for SQL` action scans a database and checks if the database meets user-defined conditions.

### Options

| Option                                     | Description                                                                                                                                                                                                                                                                 |
| ------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Action name                                | The name of the workflow action.                                                                                                                                                                                                                                            |
| Connection                                 | Identifies the database connection to use.                                                                                                                                                                                                                                  |
| Target schema                              | Name of the table schema to evaluate.                                                                                                                                                                                                                                       |
| Target table name                          | Name of the table to evaluate.                                                                                                                                                                                                                                              |
| Success condition                          |                                                                                                                                                                                                                                                                             |
| Success when rows count                    | <p>Defines the evaluation method used to compare the number of rows with the given value. The options are:</p><ul><li>Equal to</li><li>Different from</li><li>Smaller than</li><li>Smaller or equal to</li><li>Greater than (default)</li><li>Greater or equal to</li></ul> |
| Row count value                            | Defines the row count value used for the evaluation                                                                                                                                                                                                                         |
| Maximum timeout                            | After this timeout period, the workflow action continues with a fail, by default, or success, if the Success on timeout option is checked. Expressed in seconds, 0 is infinite.                                                                                             |
| Check cycle time                           | Sets the amount of time between evaluations, expressed in seconds.                                                                                                                                                                                                          |
| Success on timeout                         | Defines workflow action success behavior when timeout is reached---when checked, reaching the maximum timeout limit causes the workflow action to succeed. When left unchecked, reaching the maximum timeout limit causes the workflow action to fail.                      |
| Custom SQL                                 |                                                                                                                                                                                                                                                                             |
| Custom SQL                                 | Enables the use of custom SQL queries.                                                                                                                                                                                                                                      |
| Use variable substitution                  | Replaces environment variables in the SQL script with their actual value.                                                                                                                                                                                                   |
| Clear list of result rows before execution | Clears the list of result rows before running this workflow action.                                                                                                                                                                                                         |
| Add rows to result                         | Includes returned rows to the result set.                                                                                                                                                                                                                                   |
| SQL Script                                 | The custom SQL script to use when the `Custom SQL` option is enabled.                                                                                                                                                                                                       |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.primeur.com/data-shaper-1.21/knowing-the-data-shaper-designer/workflows/actions/waitforsql.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
