Share via


ServerRole Object

未來的 Microsoft SQL Server 版本將移除這項功能。請避免在新的開發工作中使用這項功能,並規劃修改目前使用這項功能的應用程式。

The ServerRole object exposes the attributes of a single Microsoft SQL Server security role not constrained to operation within a single database.

顯示目前物件的 SQL-DMO 物件模型

備註

SQL Server security roles establish rights to SQL Server resources for more than a single user and can be established within the constraint of a single database. Security roles can also grant permissions to an authenticated user for an instance of SQL Server. For example, the server role securityadmin has permissions that allow members to add, change, and remove SQL Server logins.

With the ServerRole object, you can:

  • Assign membership in a server role to a SQL Server login.

  • Remove a member login from a SQL Server security role.

SQL Server establishes server roles. New server roles cannot be defined by the user. For more information about valid ServerRole Name strings, see sp_addsrvrolemember (Transact-SQL).