RSS Feed

BINARY CHECKSUM

BINARY CHECKSUM

BINARY_CHECKSUM is a function that identifies changes to a row of a table. The results of BINARY_CHECKSUM are impacted by order of columns. BINARY_CHECKSUM takes case-sensitivity into account.

From MSDN (), BINARY_CHECKSUM (*) will return a different value for most, but not all, changes to the row, and can be used to detect most row modifications.

Example of BINARY_CHECKSUM
CREATE TABLE EMP(x INT PRIMARY KEY,
                 Name Varchar(20) )
INSERT INTO EMP VALUES (1, 'AAA')

Select * from EMP




SELECT BINARY_CHECKSUM(*) from EMP




update EMP
set Name='KKK' where x=1

Select * from EMP




SELECT BINARY_CHECKSUM(*) from EMP


update EMP
set Name='AAA' where x=1
SELECT BINARY_CHECKSUM(*) from EMP

No comments:

Post a Comment