hash a SQL row?

sql, sql-server, sql-server-2008

Solution

There are `CHECKSUM(*)`, `BINARY_CHECKSUM(*)` and `CHECKSUM_AGG`. They do CRC32 like checkum, but for detecting changes to a row it should be more than enough (you are talking about 1 in 4 billion chances for a false negative collision).

Doing a cryptographic hash using `HASHBYTES` requires you to construct an expression representing the 'row'.

Problem

Is there a way to md5sum a row in a SQL table to check whether any column has been modified? I would like to check whether any particular column has been changed versus an old copy of the data which i hold in a text file (which I will md5sum in C#). EDIT: Just md5sum-ing each row

Original source

Related problems