Table.RowCountAsDouble Property


Gets the number of rows in the table as a floating point value.

Namespace:   Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)

public double RowCountAsDouble { get; }

Property Value

Type: System.Double

A T:System.Float64 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.


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

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


$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.RowCountAsDouble "rows."
Return to top