Database.Rules Database.Rules Database.Rules Property

정의

컬렉션을 가져옵니다 Rule 개체입니다. Gets a collection of Rule objects. Rule 개체는 데이터베이스에 정의된 규칙을 나타냅니다. Each Rule object represents a rule defined on the database.

public:
 property Microsoft::SqlServer::Management::Smo::RuleCollection ^ Rules { Microsoft::SqlServer::Management::Smo::RuleCollection ^ 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.Rule))]
public Microsoft.SqlServer.Management.Smo.RuleCollection Rules { get; }
Public ReadOnly Property Rules As RuleCollection
속성 값

데이터베이스에 정의된 모든 규칙을 나타내는 RuleCollection 개체입니다. A RuleCollection object that represents all the rules that are defined on the database.

예제

VBVB

'Connect to the local, default instance of SQL Server.  
Dim srv As Server  
srv = New Server  

'Reference the AdventureWorks2012 database.  
Dim db As Database  
db = srv.Databases("AdventureWorks2012")  

'Display all the rules in the database.  
Dim ru As Rule  
For Each ru In db.Rules  
   Console.WriteLine(.ru.Name)  
Next  

PowerShellPowerShell

$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")  
$db = New-Object Microsoft.SqlServer.Management.Smo.Database  
$db = $srv.Databases.Item("AdventureWorks2012")  

Foreach ($ru in $db.Rules)  
{  
   Write-Host $ru.Name  
}  

설명

이 컬렉션을 사용하고 규칙의 이름을 지정하여 특정 규칙을 참조할 수 있습니다.Specific rules can be referenced by using this collection by specifying the name of the rule. 컬렉션에 새 규칙을 추가하려면 규칙 생성자 Rule을 호출하십시오.To add a new rule to the collection, call the rule constructor Rule.

적용 대상