APPROX_COUNT_DISTINCT#
Returns the number of rows in a data set that has distinct non-NULL values. It uses COUNT or COUNT_BIG under the hood.
Syntax#
APPROX_COUNT_DISTINCT ( [ expression ] )
Arguments#
expression
Is an expression of any type, a value to be evaluated.
Return types#
bigint
Examples#
SELECT APPROX_COUNT_DISTINCT(ProductKey) AS accuracy
FROM dbo.StoreSalesFacts;