---
url: /process-functions/datasource-insert.md
description: Note that this has been deprecated in favour of datasource.client
---

# datasource.insert&#x20;

:::info
Note that this has been deprecated in favour of [datasource.client](/process-functions/datasource-client)
:::

Executes SQL against a datasource

This function is used to execute a SQL statement against a registered JDBC datasource.

```js
datasource.insert(datastoreName, query, [...values]])
```

#### Parameters

* `datastoreName` - The name of a registered datasource.
* `query` - `INSERT` or `CREATE` SQL statement.
* `arguments` - A list of parameterized values to insert in place of question marks in the sql statement.

#### Example

```js
let latest_generated_id = datasource.insert(
    "Internal Datastore",
    "INSERT INTO department_codes (department_id, department_name) VALUES (?, ?);", 
    [
        '001', 
        'Head Office'
    ]
);
```
