# Simple SQL Server transport usage
## Prerequisites
Ensure an instance of SQL Server (Version 2016 or above for custom saga finders sample, or Version 2012 or above for other samples) is installed and accessible on `localhost` and port `1433`. A Docker image can be used to accomplish this by running `docker run --name mssql -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=yourStrong(!)Password" -p 1433:1433 -d mcr.microsoft.com/mssql/server:latest` in a terminal.
Alternatively, change the connection string to point to different SQL Server instance.
At startup each endpoint will create its required SQL assets including databases, tables, and schemas.
The sample creates a database named `SQLServerSimple`.
## Running the sample
1. Start both the Sender and Receiver projects. Both need to be run at least once before sending a command to create the required database tables.
1. Press c to send a [command](/nservicebus/messaging/messages-events-commands.md), or e to publish an [event](/nservicebus/messaging/messages-events-commands.md), from Sender to the Receiver.
1. The Receiver handles the message.
## Code walk-through
### Configuring the SQL Server transport
```cs
// SQL Server transport configuration with different connection string options
// for SqlExpress:
//var connectionString = @"Data Source=.\SqlExpress;Initial Catalog=SqlServerSimple;Integrated Security=True;Max Pool Size=100;Encrypt=false";
// for SqlServer:
//var connectionString = @"Server=localhost,1433;Initial Catalog=SqlServerSimple;User Id=SA;Password=yourStrong(!)Password;Max Pool Size=100;Encrypt=false";
// for LocalDB (default choice for development):
var connectionString = @"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=SqlServerSimple;Integrated Security=True;Connect Timeout=30;Max Pool Size=100;Encrypt=False;Trust Server Certificate=False;Application Intent=ReadWrite;Multi Subnet Failover=False";
// Configure SQL Server transport
var routing = endpointConfiguration.UseTransport(new SqlServerTransport(connectionString)
{
TransportTransactionMode = TransportTransactionMode.SendsAtomicWithReceive
});
// Define message routing: MyCommand messages should be sent to the SimpleReceiver endpoint
routing.RouteToEndpoint(typeof(MyCommand), "Samples.SqlServer.SimpleReceiver");
```