다음을 통해 공유


DatabaseRole Object

Microsoft SQL Server의 이후 버전에서는 이 기능이 제거됩니다. 새 개발 작업에서는 이 기능을 사용하지 말고, 현재 이 기능을 사용하는 응용 프로그램은 수정하십시오.

The DatabaseRole object represents the properties of a single Microsoft SQL Server database role.

현재 개체를 보여 주는 SQL-DMO 개체 모델

Properties

AppRole Property

Password Property

Name Property

 

Methods

AddMember Method

ListDatabasePermissions Method

DropMember Method

ListObjectPermissions Method

EnumDatabaseRoleMember Method

Remove Method (Objects)

EnumFixedDatabaseRolePermission Method

Script Method

IsFixedRole Method

 

주의

SQL Server database roles establish groups of users with similar security attributes. Database permissions can be granted by role, simplifying database security planning and administration. With the DatabaseRole object, you can:

  • Create a SQL Server database role.
  • Administer an existing SQL Server database role by adding or dropping role members.

The Name property of a DatabaseRole object uses the SQL Server data type sysname.

To create a SQL Server database role

  1. Create a DatabaseRole object.

  2. Set the Name property.

  3. If creating a SQL Server application role, set the AppRole property to TRUE. Set the Password property on the application role (optional).

  4. Add the DatabaseRole object to the DatabaseRoles collection of a connected Database object.

  5. Add members to the DatabaseRole. Members can be drawn from the Name property of User objects in the Users collection of the Database object.

After creating the new SQL Server database role, you can use the Grant and Deny methods of the Database, StoredProcedure, Table, and View objects to set permissions for the new SQL Server database role.

To administer an existing SQL Server database role

  1. Get the DatabaseRole object that references the SQL Server database role from the DatabaseRoles collection of a connected SQLServer Database object.

  2. Use the AddMember or DropMember method to add or remove a specified user. SQL Distributed Management Objects (SQL-DMO) applies the changes to the SQL Server database role as you make them.

[!참고] The DatabaseRole object is compatible with instances of SQL Server version 7.0 and later. However, the DatabaseRole2 object extends the functionality of the DatabaseRole object for use with features that were introduced in SQL Server 2000.

참고 항목

참조

DatabaseRole2 Object

관련 자료

구독 관리 프로젝트 시작

도움말 및 정보

SQL Server 2005 지원 받기