> ## Documentation Index
> Fetch the complete documentation index at: https://major-5cc5eebc-docs-bot-mr2qm9w6-typctx.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Microsoft SQL Server

> Connect to Microsoft SQL Server databases for queries and schema discovery.

The `MSSQLResourceClient` provides query execution and schema discovery against Microsoft SQL Server databases.

## Usage

```typescript theme={null}
import { myMssqlClient } from "./clients";

const result = await myMssqlClient.invoke(
  "SELECT * FROM users WHERE id = @p1",
  [123],
  "get-user"
);

if (result.ok) {
  console.log(result.result.rows);
}
```

## Inputs

The `invoke` method accepts the following arguments:

<ParamField path="sql" type="string" required>
  The SQL query string to execute. Use `@p1`, `@p2`, etc., for parameterized queries.
</ParamField>

<ParamField path="params" type="(string | number | boolean | null)[]">
  An array of values for the parameterized query.
</ParamField>

<ParamField path="invocationKey" type="string" required>
  A unique identifier for this operation, used for tracing and logging.
</ParamField>

<ParamField path="timeoutMs" type="number">
  Optional timeout in milliseconds for the query execution.
</ParamField>

## Outputs

On success (`ok: true`), the `result` object contains:

<ResponseField name="kind" type="&#x22;database&#x22;">
  Discriminator for the response type.
</ResponseField>

<ResponseField name="rows" type="Record<string, unknown>[]">
  An array of objects representing the rows returned by the query.
</ResponseField>

<ResponseField name="rowsAffected" type="number">
  The number of rows affected by the query.
</ResponseField>

## Schema Discovery

The client supports listing schemas, tables, and columns for exploring your database structure.
