Posts

Showing posts from January, 2010

Binary checksum does not consider more than 255 characters in Microsoft SQL Server

Image
     Binary checksum in Microsoft SQL Server is a good function to compare strings in data base without affecting performance of queries. The function Binary_CheckSum() will genreate a checksum for the string entered in the specified column and it will be easier and faster to compare that integer value rather than comparing the strings. The benefit of using Binary_CheckSum() instead of checksum() is that it is case sensitive as it uses the ASCII value of each character and  calculates the Binary_CheckSum().      But think twice before using these functions for large strings. These functions will consider only 255 characters. If the character length exceeds 255 characters, the check sum will reset and start again and consider characters greater than 256 only. So, for example, the computed Binary checksum of the single character 'a' will be same as that of a 257 character string whose last character is 'a'.