0

I am trying to understand binary_checksum and how it works in this scenario,

Value for a and b is its their ASCII values(97,98) but ab and ac is returning some other values (1650,1651).

The query is,

    select binary_checksum(7), id,binary_checksum('a'), binary_checksum('b'), 
binary_checksum('ab'), binary_checksum('ad') from employees;

How does it work ? Please explain.

Imran Ali Khan
  • 8,469
  • 16
  • 52
  • 77
Mani
  • 187
  • 2
  • 5
  • 14
  • 2
    Have you read the documentation? https://msdn.microsoft.com/en-us/library/ms173784.aspx. – Gordon Linoff Feb 23 '15 at 12:47
  • Here is a very nice intro: http://blog.sqlauthority.com/2010/08/01/sql-server-introduction-to-binary_checksum-and-working-example/ and read this discussion: http://stackoverflow.com/questions/1240425/what-are-the-differences-between-checksum-and-binary-checksum-and-when-what – EaziLuizi Feb 23 '15 at 12:54

1 Answers1

1

BINARY_CHECKSUM usually used to detect changes in a row. If any row has any value changed, this function can be used to figure out if the values are changed in the rows. However, if the row is changed from A to B and once again changed back to A, the BINARY_CHECKSUM cannot be used to detect the changes.

Hope you already check this. binary_checksum

binary_checksum-and-working-example

Alternative to Binary_CheckSum :Using HASHBYTES() to compare columns

checksum-functions-in-sql-

McNets
  • 10,352
  • 3
  • 32
  • 61
A_Sk
  • 4,532
  • 3
  • 27
  • 51
  • My main moto is to achieve the same functionality in netezza ? Thats why i am trying to understand this ! can anyone help on this ? – Mani Feb 23 '15 at 14:09