count_big

Description

Returns the number of (distinct) non-null values or the number of selected rows as a bigint.

Syntax

count_big([all | distinct] expression)

Parameters

all

applies count_big to all values. all is the default.

distinct

eliminates duplicate values before count_big is applied. distinct is optional.

expression

is a column name, constant, function, any combination of column names, constants, and functions connected by arithmetic or bitwise operators, or a subquery. With aggregates, an expression is usually a column name.

Examples

Example 1

Finds the number of occurances of name in systypes:

1> select count_big(name) from systypes
2> go
--------------------
42

Usage

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute count_big.

See also

Commands compute clause, group by and having clauses, select, where clause