Server.Roles Server.Roles Server.Roles Property

정의

컬렉션을 나타냅니다 ServerRole 개체입니다. Represents a collection of ServerRole objects. ServerRole 개체의 SQL Server 인스턴스에 정의 된 역할을 나타냅니다. Each ServerRole object represents a role defined on the instance of SQL Server.

public:
 property Microsoft::SqlServer::Management::Smo::ServerRoleCollection ^ Roles { Microsoft::SqlServer::Management::Smo::ServerRoleCollection ^ get(); };
[Microsoft.SqlServer.Management.Sdk.Sfc.Metadata.SfcObject(Microsoft.SqlServer.Management.Sdk.Sfc.Metadata.SfcContainerRelationship.ObjectContainer, Microsoft.SqlServer.Management.Sdk.Sfc.Metadata.SfcContainerCardinality.ZeroToAny, typeof(Microsoft.SqlServer.Management.Smo.ServerRole))]
public Microsoft.SqlServer.Management.Smo.ServerRoleCollection Roles { get; }
Public ReadOnly Property Roles As ServerRoleCollection
속성 값

A ServerRoleCollection SQL Server의 인스턴스에 정의 된 모든 역할을 나타내는 개체입니다. A ServerRoleCollection object that represents all the roles defined on the instance of SQL Server.

예제

Visual BasicVisual Basic

'Connect to the local, default instance of SQL Server.  
Dim srv As Server  
srv = New Server  
'Display the fixed server roles.  
Dim sr As ServerRole  
For Each sr In srv.Roles  
   Console.WriteLine(sr.Name)  
Next  

PowerShellPowerShell

$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")  
foreach ($sr in $srv.Roles)  
{  
   Write-Host $sr.Name  
}  

설명

Roles 속성은 ServerRoleCollection 개체를 가리킵니다.The Roles property points to the ServerRoleCollection object. 컬렉션을 사용하여 SQL Server 인스턴스의 고정 서버 역할을 참조할 수 있습니다.You can use the collection to reference the fixed server roles the instance of SQL Server.

적용 대상