---
url: /process-functions/script-processupdatequery.md
description: Changes the SQL used by the process's datasource.
---

# script.processUpdateQuery

Changes the SQL used by the process's datasource, for this run. Call it in `begin()`, such as to build the query from a prompt's answer. The datasource is read once `begin()` finishes, so calling it later, or in `pre()`, has no effect.

```js
script.processUpdateQuery(sqlQuery)
```

## Parameters

| Parameter | Type | Description |
|---|---|---|
| `sqlQuery` | `string` | The new SQL. |

## Examples

```js
const sqlQuery = "SELECT * FROM products";
script.processUpdateQuery(sqlQuery);
```

## Related

* [script.getQuery](/process-functions/script-getquery)
* [script.escape](/process-functions/script-escape)
* [script.prompt](/process-functions/script-prompt)
