﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server 2008 - General  / How to Use BINARY_CHECKSUM operation. / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 19 Jun 2013 01:34:45 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: How to Use BINARY_CHECKSUM operation.</title><link>http://www.sqlservercentral.com/Forums/Topic1038399-391-1.aspx</link><description>Well it appears that you have a case insensitive collation, so CHECKSUM won't show a difference between the same word with different cased letters. Just as if you did it in SQL; 'test' =  'TEST'.If you need to make that sort of update there are several options. One option is to COLLATE your strings to something Case Sensitive before applying the CHECKSUM function. Another option is to use the BINARY_CHECKSUM function (updating your checksum columns type appropriately). There are other options, but those are probably the easiest.</description><pubDate>Wed, 22 Dec 2010 11:56:10 GMT</pubDate><dc:creator>Lamprey13</dc:creator></item><item><title>RE: How to Use BINARY_CHECKSUM operation.</title><link>http://www.sqlservercentral.com/Forums/Topic1038399-391-1.aspx</link><description>Hi Thanks for your query with Merge join New thing learned today on this.i have heared on this but not worked with data but now it also has been done so again spl thanks.update #myTable set column2='TEST' where column1=2If we use CHECKSUM then it does not check the above thing i have changed column2 as UPPER Case.It will be work in BINARY_CHECKSUMIf i update column2='TESTS' then it works update #myTable set column2='TESTS' where column1=2This is fine.But there is change in the string to UPPER Case which also need to be tracked must be updated in #myTable_hist Table how can we do thisThanksParthi</description><pubDate>Wed, 22 Dec 2010 11:21:38 GMT</pubDate><dc:creator>parthi-1705</dc:creator></item><item><title>RE: How to Use BINARY_CHECKSUM operation.</title><link>http://www.sqlservercentral.com/Forums/Topic1038399-391-1.aspx</link><description>This should help get you going:[code="sql"]CREATE TABLE #myTable (column1 int, column2 varchar(256));goCREATE TABLE #myTable_hist (column1 int, column2 varchar(256), HistCheck INT);GOINSERT INTO #myTable VALUES (1, 'test');INSERT INTO #myTable VALUES (2, 'test');INSERT #myTable_hist (column1, column2, HistCheck)Select column1, column2, CHECKSUM(column2)  from #myTable-- Add new rowINSERT INTO #myTable VALUES (3, 'test');WITH cteAS(    SELECT *, CHECKSUM(Column2) AS CheckVal    FROM #myTable)MERGE    #myTable_hist AS TargetUSING    cte AS Source    ON Target.column1 = Source.column1WHEN MATCHED AND (Target.HistCheck &amp;lt;&amp;gt; Source.CheckVal) THEN    UPDATE SET         Target.Column2 = Source.Column2,        Target.HistCheck = Source.CheckValWHEN NOT MATCHED THEN    INSERT (column1, column2, HistCheck)    VALUES (Source.column1, Source.column2, Source.CheckVal);    [/code]</description><pubDate>Wed, 22 Dec 2010 11:07:40 GMT</pubDate><dc:creator>Lamprey13</dc:creator></item><item><title>How to Use BINARY_CHECKSUM operation.</title><link>http://www.sqlservercentral.com/Forums/Topic1038399-391-1.aspx</link><description>Hi How to do this GOCREATE TABLE #myTable (column1 int, column2 varchar(256));goCREATE TABLE #myTable_hist (column1 int, column2 varchar(256));GOINSERT INTO #myTable VALUES (1, 'test');INSERT INTO #myTable VALUES (2, 'test');--SELECT BINARY_CHECKSUM(*) from #myTable;INSERT INTO #myTable_hist Select * from #myTable--SELECT BINARY_CHECKSUM(*) from #myTable;INSERT INTO #myTable VALUES (3, 'test');--- BINARY_CHECKSUM Need to check whether 3rd value is there are not in his table if not there then need to insert 3rd value alone-- Will be able to check with BINARY_CHECKSUM row by row checking changes are there or not with the previous records---Flag like condition for row by row processing INSERT INTO #myTable_hist Select * from #myTableGODrop  TABLE #myTable go Drop  TABLE #myTable_hist ThanksParthi</description><pubDate>Wed, 22 Dec 2010 10:51:22 GMT</pubDate><dc:creator>parthi-1705</dc:creator></item></channel></rss>