ÿþ<html> <head> <title>Set-SqlDatabasePermission</title> </head> <body> <h1>Set-SqlDatabasePermission</h1> <div>Sets database level permissions.</div> <h2> Syntax </h2> <code>Set-SqlDatabasePermission [[-sqlserver] &lt;Object&gt;] [-dbname] &lt;Object&gt; [-permission] {Alter | AlterAnyAsymmetricKey | AlterAnyApplicationRole | AlterAnyAssembly | AlterAnyCertificate | AlterAnyDataspace | AlterAnyDatabaseEventNotification | AlterAnyFulltextCatalog | AlterAnyMessageType | AlterAnyRole | AlterAnyRoute | AlterAnyRemoteServiceBinding | AlterAnyContract | AlterAnySymmetricKey | AlterAnySchema | AlterAnyService | AlterAnyDatabaseDdlTrigger | AlterAnyUser | Authenticate | BackupDatabase | BackupLog | Control | Connect | ConnectReplication | Checkpoint | CreateAggregate | CreateAsymmetricKey | CreateAssembly | CreateCertificate | CreateDatabase | CreateDefault | CreateDatabaseDdlEventNotification | CreateFunction | CreateFulltextCatalog | CreateMessageType | CreateProcedure | CreateQueue | CreateRole | CreateRoute | CreateRule | CreateRemoteServiceBinding | CreateContract | CreateSymmetricKey | CreateSchema | CreateSynonym | CreateService | CreateTable | CreateType | CreateView | CreateXmlSchemaCollection | Delete | Execute | Insert | References | Select | Showplan | SubscribeQueryNotifications | TakeOwnership | Update | ViewDefinition | ViewDatabaseState | AlterAnyDatabaseAudit} [-name] &lt;String&gt; [-action] &lt;String&gt; [&lt;CommonParameters&gt;]</code> <h2> Detailed Description </h2> <div> The Set-SqlDatabasePermission function sets database level permissions. </div> <h2> Related Commands </h2> <div> * <a href='Set-SqlDatabasePermission.htm'>Set-SqlDatabasePermission</a><br/> </div> <h2> Parameters </h2> <table border='1'> <tr> <th>Name</th> <th>Description</th> <th>Required?</th> <th>Pipeline Input</th> <th>Default Value</th> </tr> <tr valign='top'> <td>sqlserver&nbsp;</td> <td>&nbsp;</td> <td>false&nbsp;</td> <td>false&nbsp;</td> <td>&nbsp;</td> </tr> <tr valign='top'> <td>dbname&nbsp;</td> <td>&nbsp;</td> <td>true&nbsp;</td> <td>false&nbsp;</td> <td>&nbsp;</td> </tr> <tr valign='top'> <td>permission&nbsp;</td> <td>&nbsp;</td> <td>true&nbsp;</td> <td>false&nbsp;</td> <td>&nbsp;</td> </tr> <tr valign='top'> <td>name&nbsp;</td> <td>&nbsp;</td> <td>true&nbsp;</td> <td>false&nbsp;</td> <td>&nbsp;</td> </tr> <tr valign='top'> <td>action&nbsp;</td> <td>&nbsp;</td> <td>true&nbsp;</td> <td>false&nbsp;</td> <td>&nbsp;</td> </tr> </table> <h2> Input Type </h2> <div>None You cannot pipe objects to Set-SqlDatabasePermission</div> <h2> Return Values </h2> <div>None This function does not generate any output.</div> <h2> Examples </h2> <h3> EXAMPLE 1</h3> <pre>Set-SqlDatabasePermission -sqlserver "Z002\sql2k8" -dbname $database -permission "ViewDefinition" -name "TestPSUnit" -action "Grant"</pre> <div>This command grants ViewDefinition permission to the TestPSUnit user.</div> <h3> EXAMPLE 2</h3> <pre>$database = Get-SqlDatabase "Z002\sql2k8" "pubs" Set-SqlDatabasePermission -dbname $database -permission "ViewDefinition" -name "TestPSUnit" -action "Grant"</pre> <div>This command grants ViewDefinition permission to the TestPSUnit user.</div> </body> </html>