locked
What is the use of Checksum in sql server RRS feed

  • Question

  • hi all

      please help me, what is the use of checksum in sql server.

    what is the use of checksum here

    select CHECKSUM('ab') as ChecksumValue

    Sunday, July 7, 2013 12:52 PM

Answers

  • Create a hash to use for building indexes. Mostly not useful.

    http://msdn.microsoft.com/en-us/library/ms189788.aspx

    • Proposed as answer by Fanny Liu Tuesday, July 9, 2013 10:26 AM
    • Marked as answer by Fanny Liu Monday, July 15, 2013 7:53 AM
    Sunday, July 7, 2013 1:40 PM
  • http://dimantdatabasesolutions.blogspot.co.il/2007/02/compare-tables.html

    Best Regards,Uri Dimant SQL Server MVP, http://sqlblog.com/blogs/uri_dimant/

    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Blog: Large scale of database and data cleansing
    Remote DBA Services: Improves MS SQL Database Performance

    • Proposed as answer by Fanny Liu Tuesday, July 9, 2013 10:26 AM
    • Marked as answer by Fanny Liu Monday, July 15, 2013 7:53 AM
    Sunday, July 7, 2013 1:41 PM
    Answerer
  • CHECKSUM is an imperfect check that is usually good enough in cases where your 'ab' is a much larger character value you wish to compare to another large character value.

    WHERE CHECKSUM(bigchar1) = CHECKSUM(bigchar2)

    is much more efficient than

    WHERE bigchar1 = bigchar2

    While it is imperfect it can be quite useful in preselecting values that are at the very least candidates for matches so that the second comparison (bigchar1 = bigchar2) only has to be performed on the subset of all bigchar1 and bigchar2 that contains all of the bigchar1 = bigchar2 as well as those such as (CHECKSUM(bigchar1) = CHECKSUM(bigchar2) AND bigchar1 <> bigchar2).


    If you're happy and you know it vote and mark.


    • Edited by Thomas W Marshall Monday, July 8, 2013 8:43 PM Old stuff
    • Proposed as answer by Fanny Liu Tuesday, July 9, 2013 10:26 AM
    • Marked as answer by Fanny Liu Monday, July 15, 2013 7:53 AM
    Monday, July 8, 2013 8:41 PM

All replies

  • Create a hash to use for building indexes. Mostly not useful.

    http://msdn.microsoft.com/en-us/library/ms189788.aspx

    • Proposed as answer by Fanny Liu Tuesday, July 9, 2013 10:26 AM
    • Marked as answer by Fanny Liu Monday, July 15, 2013 7:53 AM
    Sunday, July 7, 2013 1:40 PM
  • http://dimantdatabasesolutions.blogspot.co.il/2007/02/compare-tables.html

    Best Regards,Uri Dimant SQL Server MVP, http://sqlblog.com/blogs/uri_dimant/

    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Blog: Large scale of database and data cleansing
    Remote DBA Services: Improves MS SQL Database Performance

    • Proposed as answer by Fanny Liu Tuesday, July 9, 2013 10:26 AM
    • Marked as answer by Fanny Liu Monday, July 15, 2013 7:53 AM
    Sunday, July 7, 2013 1:41 PM
    Answerer
  • CHECKSUM is an imperfect check that is usually good enough in cases where your 'ab' is a much larger character value you wish to compare to another large character value.

    WHERE CHECKSUM(bigchar1) = CHECKSUM(bigchar2)

    is much more efficient than

    WHERE bigchar1 = bigchar2

    While it is imperfect it can be quite useful in preselecting values that are at the very least candidates for matches so that the second comparison (bigchar1 = bigchar2) only has to be performed on the subset of all bigchar1 and bigchar2 that contains all of the bigchar1 = bigchar2 as well as those such as (CHECKSUM(bigchar1) = CHECKSUM(bigchar2) AND bigchar1 <> bigchar2).


    If you're happy and you know it vote and mark.


    • Edited by Thomas W Marshall Monday, July 8, 2013 8:43 PM Old stuff
    • Proposed as answer by Fanny Liu Tuesday, July 9, 2013 10:26 AM
    • Marked as answer by Fanny Liu Monday, July 15, 2013 7:53 AM
    Monday, July 8, 2013 8:41 PM