---
title: "sql_column | Speedscale Docs"
description: "Extract or rewrite one cell of a Postgres, MySQL or SQL Server query result with the sql_column extractor."
canonical: "https://docs.speedscale.com/guides/transformation/extractors/sql_column/"
---

[Documentation index](https://docs.speedscale.com/guides/llms.txt) | [Markdown](https://docs.speedscale.com/guides/transformation/extractors/sql_column/index.md) | [Canonical page](https://docs.speedscale.com/guides/transformation/extractors/sql_column/)

# sql\_column

<a id="purpose"></a>

### Purpose

**sql\_column** extracts one cell of a Postgres, MySQL or SQL Server result set, so transforms such as `date` or `rand_string` can fix up timestamps and generated ids in mock responses the same way they do in JSON bodies.

<a id="usage"></a>

### Usage

```json
"extractor": {
  "type": "sql_column",
  "config": {
    "row": "1",
    "name": "created_at"
  }
}
```

| Parameter | Required | Description |
| --- | --- | --- |
| `row` | No | The row, counting from 1 across every result set in the response. Defaults to 1. |
| `column` | One of `column` or `name` | The column position, counting from 1. |
| `name` | One of `column` or `name` | The column name. |

It applies to responses only. NULL extracts as an empty value and stays NULL when a transform passes it through unchanged.

<a id="limits"></a>

### Limits

*   Only text-format cells can be read and changed. Postgres drivers such as pgx often ask for binary results on prepared statements, and the extractor skips those cells.
*   Column names are only available where the response carries them: a Postgres simple query, any MySQL result, or a SQL Server result that starts with its column metadata. A Postgres prepared statement describes its columns in a separate message, and a SQL Server execute sent with `no_metadata` reuses the metadata of an earlier one, so select their columns by position.
*   A MySQL prepared statement returns binary rows, where each cell keeps its column's type. A new value that does not fit the type, such as text in an integer column, is refused and the cell keeps its recorded value.
*   A name selects the first column with that name. When a join returns two columns with the same name, select the later ones by position.

<a id="example"></a>

### Example

Shift a recorded timestamp to the time of the replay:

```text
sql_column(row=1,name=created_at) -> date(layout=auto)
```

<a id="related"></a>

## Related

*   [Matching SQL mocks](https://docs.speedscale.com/guides/databases/mock-a-database/) explains how SQL mocks match and how the SQL transforms change that.
