---
title: "mssql_param | Speedscale Docs"
description: "Extract one value a recorded SQL Server RPC binds to its statement with mssql_param, such as an @P0 of an sp_executesql or a stored procedure parameter, to reuse or rewrite it in a transform chain."
canonical: "https://docs.speedscale.com/guides/transformation/extractors/mssql_param/"
---

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

# mssql\_param

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

### Purpose

**mssql\_param** extracts one value that a recorded SQL Server RPC binds to its statement: a parameter of an `sp_executesql`, `sp_prepexec` or `sp_execute`, or of a stored procedure called by name. Pair it with [var\_store](https://docs.speedscale.com/guides/transformation/transforms/variable_store/) to reuse the value, for example in a mocked result, or with a transform that rewrites it.

It applies only to requests, and only to RPCs. SQL batches carry their values as literals in the T-SQL; reach those with [sql\_literal](https://docs.speedscale.com/guides/transformation/extractors/sql_literal/). To make a mock match on bound values, use [sql\_key\_params](https://docs.speedscale.com/guides/transformation/transforms/sql_key_params/).

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

### Usage

```json
"type": "mssql_param",
"config": {
    "index": "1"
}
```

*   **index** - the position of the bound value, counting from 1. The statement and parameter declaration an `sp_executesql` or `sp_prepexec` sends first, and the handle an `sp_execute` sends first, are not counted, so `@P0` is 1.
*   **name** - (optional, instead of **index**) the parameter's name, such as `@id`, with or without the `@`.

The extracted value is text, as SQL Server Management Studio shows it: numbers in decimal, `bit` as 1 or 0, binary as `0x` hex, dates in ISO 8601, and `NULL` as an empty value. When a transform writes a new value, it keeps the parameter's type, and a value that does not fit the type, such as letters for an `int`, is an error.

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

### Example

Store the order id an `sp_executesql` lookup asks for, its first bound value, in a variable:

```json
{
    "filters": {"filters": [{"include": true, "detectedLocation": "FROM dbo.orders WHERE id", "operator": "CONTAINS"}]},
    "extractor": {"type": "mssql_param", "config": {"index": "1"}},
    "transforms": [{"type": "var_store", "config": {"name": "order_id"}}]
}
```

See [Record SQL Server](https://docs.speedscale.com/proxymock/databases/record/sqlserver/#mock) for mocking SQL Server.
