---
title: SQL Server
description: Configure DurableStack with SQL Server for durable shared-state execution.
order: 54
available_in: [dotnet, nodejs]
---

# SQL Server

SQL Server is a durable provider option for environments standardized on Microsoft data infrastructure.

It supports shared run coordination across workers through the same DurableStack contract.

## Registration

:::code-group
```csharp
using DurableStack.Hosting.DependencyInjection;

var connectionString = "Server=localhost;Database=durable_stack;User Id=sa;Password=Password123!;TrustServerCertificate=true";

builder.Services.AddDurableStackSqlServer(connectionString, options =>
{
    options.WorkerName = $"billing-api-{Environment.MachineName}-{Environment.ProcessId}";
});
```

```typescript
import { createDurableStackSqlServer } from "durablestack";

const { runtime } = await createDurableStackSqlServer(
  { connectionString: process.env.SQLSERVER_URL! },
  {
    workerName: `billing-api-${process.pid}`
  }
);
```
:::

## Operational notes

- Prefer secure transport settings in production (`Encrypt=True`, trusted cert chain).
- Validate lock/throughput behavior under expected concurrency.
- Keep table-prefix strategy consistent across environments if used.
