SQL Server 2008 Books Online (November 2009)
CountRows Function (Reporting Services)

Returns the number of rows in the specified scope, including rows with null values.

Syntax

CountRows(scope, recursive)
Parameters

scope

(String) The name of a dataset, data region, or group that contains the report items to count. For more information, see Using Built-in Report and Aggregate Functions in Expressions (Reporting Services) and Calculating Totals and Other Aggregates (Reporting Services).

recursive

(Enumerated Type) Optional. Simple (default) or RdlRecursive. Specifies whether to perform the aggregation recursively. For more information, see Creating Recursive Hierarchy Groups (Reporting Services).

Return Type

Returns an Integer.

Remarks

CountRows counts all rows in the specified scope, including rows that have null values.

The value of scope cannot be an expression and must refer to the current scope or a containing scope.

Example

The following code example shows an expression that calculates the number of rows in a row group named GroupbyCategory (based on the expression [Category]).

="Number of rows: " & CountRows("GroupbyCategory")
See Also

Concepts

Using Expressions (Reporting Services)
Using Built-in Report and Aggregate Functions in Expressions (Reporting Services)

Help and Information

Getting SQL Server 2008 Assistance
Tags :


Page view tracker