# Aspire.Hosting.SqlServer

- Module: `Aspire.Hosting.SqlServer`
- Version: `17.0.0`
- Import path: `apphost/modules/aspire`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)
- Functions: `8`
- Types: `3`

## Handles

- [SqlServerDatabaseResource](/reference/api/go/aspire.hosting.sqlserver/sqlserverdatabaseresource.md) -- `handle` - 7 members -- A resource that represents a SQL Server database that is a child of a SQL Server container resource.
- [SqlServerReplOptions](/reference/api/go/aspire.hosting.sqlserver/sqlserverreploptions.md) -- `handle` - 1 members -- Options for configuring the SQL Server REPL.
- [SqlServerServerResource](/reference/api/go/aspire.hosting.sqlserver/sqlserverserverresource.md) -- `handle` - 16 members -- A resource that represents a SQL Server container.

## Functions

- [AddSqlServer](/reference/api/go/aspire.hosting.sqlserver/addsqlserver.md) -- `method` - on `DistributedApplicationBuilder` -- Adds a SQL Server resource to the application model. A container is used for local development.
- [WithCreationScript](/reference/api/go/aspire.hosting.sqlserver/withcreationscript.md) -- `method` - on `SqlServerDatabaseResource` -- Defines the SQL script used to create the database.
- [AddDatabase](/reference/api/go/aspire.hosting.sqlserver/adddatabase.md) -- `method` - on `SqlServerServerResource` -- Adds a SQL Server database resource
- [WithDataBindMount](/reference/api/go/aspire.hosting.sqlserver/withdatabindmount.md) -- `method` - on `SqlServerServerResource` -- Adds a bind mount for the data folder to a SQL Server resource.
- [WithDataVolume](/reference/api/go/aspire.hosting.sqlserver/withdatavolume.md) -- `method` - on `SqlServerServerResource` -- Adds a named volume for the data folder to a SQL Server resource.
- [WithHostPort](/reference/api/go/aspire.hosting.sqlserver/withhostport.md) -- `method` - on `SqlServerServerResource` -- Configures the host port that the SqlServer resource is exposed on instead of using randomly assigned port.
- [WithPassword](/reference/api/go/aspire.hosting.sqlserver/withpassword.md) -- `method` - on `SqlServerServerResource` -- Configures the password that the SqlServer resource is used.
- [WithRepl](/reference/api/go/aspire.hosting.sqlserver/withrepl.md) -- `method` - on `SqlServerServerResource` -- Adds a REPL command that opens an authenticated SQL Server shell with the configured client tools.

## Exported values

- `SqlServerReplCommand.Version17`: `string` = `"/opt/mssql-tools/bin/sqlcmd"` -- The sqlcmd executable path for SQL Server client tools version 17.
- `SqlServerReplCommand.Version18`: `string` = `"/opt/mssql-tools18/bin/sqlcmd"` -- The sqlcmd executable path for SQL Server client tools version 18.
