SQL Flow Field Guide

VARP

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

aggregation

What changes

Input
the argument expression over each group's rows (COUNT(*) reads no column)
Output or change
one value per group (or one for the whole input when there is no GROUP BY)
Return type
float

Syntax at a glance

VARP ( [ ALL | DISTINCT ] expression )

Work example

Calculate variance when every member of the population is present.

Try null-only, duplicate, and one-row groups. Check result type and whether the aggregate is exact.

Check your work Confirm the group is the full population and interpret the result in squared units.

Open Microsoft Learn for full syntax, permissions, and details for your version.