# Execute SQL script

## ![](/files/UJQwfwmsEEgUOIcLyC7O) Execute SQL script

### Description <a href="#description" id="description"></a>

The Execute SQL Script transform runs a SQL script either once, during the initialization phase of the pipeline, or once for every input-row that the transform receives.

When used for every input row, parameters can be passed to the SQL scripts specified in the transform.

| Hop Engine | <sup>✓</sup> |
| ---------- | ------------ |
| Spark      | ?            |
| Flink      | ?            |
| Dataflow   | ?            |

### Options

| Option                        | Description                                                                                                                                                                                                            |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Transform name                | Name of the transform; This name has to be unique in a single pipeline                                                                                                                                                 |
| Connection                    | Select a database connection to use                                                                                                                                                                                    |
| SQL script to execute         | Specify the SQL to execute. Separate statements by ; and use question marks as place holders for parameter.                                                                                                            |
| Execute for each row?         | Select this option to execute the SQL for each incoming row. In this case parameters can be used. When this option is unchecked, the SQL statement is executed at the transform initialization phase.                  |
| Execute as a single statement | This option does not split the statements by ; and will send the whole SQL to the database.                                                                                                                            |
| Variable substitution         | In case you want to use variables in the SQL, e.g. ${table\_name}, this option needs to be checked. If you are using Parameter fields, they are only used in conjunction with "question marks" in the SQL (see below). |
| Bind parameters?              | Check this option to bind parameters using prepared statements, otherwise this transform will perform a literal string replacement of the parameters.                                                                  |
| Quote Strings?                | This option adds quotes around the string according to the database dialect and also escapes special characters like CR, LF and the quote character itself.                                                            |
| Parameters                    | The list of parameters that will replace the question marks in the query in the given order. So the first question mark will be replaced by the first parameter, the second question mark by the second parameter etc. |
| Field to contain insert stats | Optional: If you want to get an additional field in our stream with the number or records that where inserted, please define the field name here.                                                                      |
| Field to contain update stats | Same as insert stats, but for updated rows.                                                                                                                                                                            |
| Field to contain delete stats | Same as insert stats, but for deleted rows.                                                                                                                                                                            |
| Field to contain read stats   | Same as insert stats, but for read rows.                                                                                                                                                                               |


---

# 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/pipelines/transforms/execsql.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.
