BINARY_CHECKSUM function

When having to compare 2 rows (usually same table structure and with the same primary key), the easiest way is to use the SQL function BINARY_CHECKSUM

But, after quite a few discussions on the various SQL list servers, there seems to be a very small window of opportunity for the function to return the same checksum and it may occur frequently. The wider the row and the smaller the difference between them can possibly result in this condition. But that is the same for any type of checksum.

You just have to see if it's precision fits your requirement. Test, Test, Test and then Test again to see if it is good enough for you to use in production.

As a work-around, you could possibly, row by row, compare one column at a time, and not just a subset expression or even the whole row.

It is a very useful function, but just be aware of it's limitations.

Published Tue, Jul 20 2004 19:11 by Mike Epprecht
Filed under: