Table.RowCount 속성

Gets the number of rows in the table.

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

구문

‘선언
<SfcPropertyAttribute(SfcPropertyFlags.Standalone)> _
Public ReadOnly Property RowCount As Long 
    Get
‘사용 방법
Dim instance As Table 
Dim value As Long 

value = instance.RowCount
[SfcPropertyAttribute(SfcPropertyFlags.Standalone)]
public long RowCount { get; }
[SfcPropertyAttribute(SfcPropertyFlags::Standalone)]
public:
property long long RowCount {
    long long get ();
}
[<SfcPropertyAttribute(SfcPropertyFlags.Standalone)>]
member RowCount : int64
function get RowCount () : long

속성 값

유형: System.Int64
An Int64 value that specifies the number of rows in the table.

The following code example displays the number of rows contained in each table of the AdventureWorks2012 database.

C#

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

foreach (Table tb in db.Tables) 
{
   Console.WriteLine("The " + tb.Name + " contains " + tb.RowCount + " rows.");
}

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) 
{
   Write-Host "The" $tb.Name "conains" $tb.RowCount "rows."
}

참고 항목

참조

Table 클래스

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

관련 자료

테이블

CREATE TABLE(Transact-SQL)