The checksum value computed over a table row or an expression list is returned by the CHECKSUM function. To create hash indexes, use CHECKSUM. In other words, this function calculates a checksum for a full row or a subset of the row’s columns.
It returns an integer after calculating a hash for one or more values in a single row.
Syntax: CHECKSUM ( * | expression [ ,…n ] )
SELECT CHECKSUM(EmpNo, Ename, Sal) FROM Emp;
The checksum of a group of values is returned by this function. Null values are ignored by CHECKSUM AGG. CHECKSUM AGG can be followed by the OVER clause. This function, in other terms, generates a checksum for a dataset.
It creates an aggregated checksum for each group using a single integer value from many rows.
Syntax: CHECKSUM_AGG ( [ ALL | DISTINCT ] expression )
“ALL” applies the aggregate function to all values. ALL is the default argument. “DISTINCT” specifies that CHECKSUM_AGG returns the checksum of unique values.
SELECT CHECKSUM_AGG(Sal) Sal_checksum_agg
Hope you find this article helpful.
Please subscribe for more interesting updates.