Cmdlets to provide and manage SQL servers for tests.
Creates a new database and returns the connection parameters.
New-SqlTestDatabase [-Instance] <PSObject> [-InstanceConnection] <SqlConnection> [[-Name] <String>]
[-Connected] [<CommonParameters>]
Uses a existing test instance and creates a database for (temporary) use. It keeps an open connection to the instance for later removal.
$Instance = New-SqlTestInstance
PS> $InstanceConnection = $Instance | Connect-TSqlInstance
PS> New-SqlTestDatabase -Instance $Instance -InstanceConnection $InstanceConnection
ConnectionString : Data Source=(LocalDb)\MSSQLLocalDB;Connect Timeout=30;Integrated Security=True;Initial Catalog=a48b028c DataSource : (LocalDb)\MSSQLLocalDB ConnectTimeout : 30 Version : v11.0 InitialCatalog : a48b028c InstanceConnection : Microsoft.Data.SqlClient.SqlConnection
Specifies the instance, to create the database in.
Type: PSObject
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Specifies a open sql connection to the instance.
Type: SqlConnection
Parameter Sets: (All)
Aliases: Connection
Required: True
Position: 2
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
Specifies the name of the database to create.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: ( New-DatabaseName )
Accept pipeline input: False
Accept wildcard characters: False
Speficies if a SqlClient connection should be created.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.