Add-SqlDatabaseRole
Adds a new database role to a database.
Syntax
Add-SqlDatabaseRole [[-sqlserver] <Object>] [-dbname] <Object> [-name] <String> [<CommonParameters>]
Detailed Description
The Add-SqlDatabaseRole function adds a new database role to the specified database.
Related Commands
Parameters
Name |
Description |
Required? |
Pipeline Input |
Default Value |
sqlserver |
|
false |
false |
|
dbname |
|
true |
false |
|
name |
|
true |
false |
|
Input Type
None
You cannot pipe objects to Add-SqlDatabaseRole
Return Values
None
This function does not generate any output.
Examples
EXAMPLE 1
Add-SqlDatabaseRole "Z002\sql2k8" "pubs" "TestPSUnitDBRole"
This command adds the TestPSUnitDBRole role to the pubs database.
EXAMPLE 2
$database = Get-SqlDatabase "Z002\sql2k8" "pubs"
Add-SqlDatabaseRole -dbname $database -name "TestPSUnitDBRole"
This command adds the TestPSUnitDBRole role to the pubs database.