---
url: /process-functions/datasource-select.md
description: >-
  Runs a SELECT statement against a datasource and returns the rows as a JSON
  string.
---

# datasource.select&#x20;

Runs a SELECT statement against a datasource and returns the rows as a JSON string.

::: warning Deprecated
Use [`datasource.client(datasource).select(query, params)`](/process-functions/datasourceclient#select) instead.
:::

```js
datasource.select(datasource, query, parameters, extended)
```

## Parameters

| Parameter | Type | Description |
|---|---|---|
| `datasource` | `string` | The datasource's name. It must be a JDBC datasource. |
| `query` | `string` | The SELECT statement. Use `?` placeholders for values. |
| `parameters` | `string[]` | Optional. Values for the `?` placeholders, in order. |
| `extended` | `boolean` | Optional. `true` to include the returned columns' data types and details. |

## Returns

The rows as a JSON string, with every value as a string. Read it with `JSON.parse()`.

## Examples

```js
const rows = JSON.parse(datasource.select("Internal Datastore", "SELECT department_id, department_name FROM department_codes;"));
```
