EnumForeignKeys 메서드
테이블이 외래 키로 참조되는 기본 키 목록을 열거합니다.
네임스페이스: Microsoft.SqlServer.Management.Smo
어셈블리: Microsoft.SqlServer.Smo(Microsoft.SqlServer.Smo.dll)
구문
‘선언
Public Function EnumForeignKeys As DataTable
‘사용 방법
Dim instance As Table
Dim returnValue As DataTable
returnValue = instance.EnumForeignKeys()
public DataTable EnumForeignKeys()
public:
DataTable^ EnumForeignKeys()
member EnumForeignKeys : unit -> DataTable
public function EnumForeignKeys() : DataTable
예
The following code example demonstrates how to enumerate a list of the primary keys that reference the table as a foreign key.
C#
Server srv = new Server("(local)");
Database db = srv.Databases["AdventureWorks2008R2"];
foreach (Table tb in db.Tables)
{
tb.EnumForeignKeys();
}
Powershell
$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$db = New-Object Microsoft.SqlServer.Management.Smo.Database
$db = $srv.Databases.Item("AdventureWorks2008R2")
foreach ($tb in $db.Tables)
{
$tb.EnumForeignKeys()
}