다음을 통해 공유


Table.Checks 속성

Represents a collection of Check objects. Each Check object represents a check constraint defined on the table.

네임스페이스:  Microsoft.SqlServer.Management.Smo
어셈블리:  Microsoft.SqlServer.Smo(Microsoft.SqlServer.Smo.dll)

구문

‘선언
<SfcObjectAttribute(SfcContainerRelationship.ChildContainer, SfcContainerCardinality.ZeroToAny,  _
    GetType(Check), SfcObjectFlags.Design)> _
Public ReadOnly Property Checks As CheckCollection 
    Get
‘사용 방법
Dim instance As Table 
Dim value As CheckCollection 

value = instance.Checks
[SfcObjectAttribute(SfcContainerRelationship.ChildContainer, SfcContainerCardinality.ZeroToAny, 
    typeof(Check), SfcObjectFlags.Design)]
public CheckCollection Checks { get; }
[SfcObjectAttribute(SfcContainerRelationship::ChildContainer, SfcContainerCardinality::ZeroToAny, 
    typeof(Check), SfcObjectFlags::Design)]
public:
property CheckCollection^ Checks {
    CheckCollection^ get ();
}
[<SfcObjectAttribute(SfcContainerRelationship.ChildContainer, SfcContainerCardinality.ZeroToAny, 
    typeof(Check), SfcObjectFlags.Design)>]
member Checks : CheckCollection
function get Checks () : CheckCollection

속성 값

유형: Microsoft.SqlServer.Management.Smo.CheckCollection
A Check object that represents all the check constraints that are defined on the table.

The following code example shows how to display the names of each check constraint on each AdventureWorks2012 table.

C#

Server srv = new Server("(local)");
Database db = srv.Databases["AdventureWorks2012"];

foreach (Table tb in db.Tables)
{
   foreach (Check ck in tb.Checks)
   {
      Console.WriteLine("The " + tb.Name + " table has the " + ck.ToString() + " check.");
   }
}

Powershell

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

Foreach ($tb in $db.Tables)
{
   Foreach ($ck in $tb.Checks)
   {
      Write-Host "The" $tb.Name "table has the" $ck "check."
   }
}

참고 항목

참조

Table 클래스

Microsoft.SqlServer.Management.Smo 네임스페이스

관련 자료

테이블

CREATE TABLE(Transact-SQL)