Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

BINARY CHECKSUM Expand / Collapse
Author
Message
Posted Monday, April 27, 2009 9:19 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Monday, November 17, 2014 6:16 AM
Points: 222, Visits: 334
Comments posted to this topic are about the item BINARY CHECKSUM

Sriram

Post #705482
Posted Tuesday, April 28, 2009 7:11 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Wednesday, October 9, 2013 5:08 AM
Points: 1,123, Visits: 603
Anyone who still uses text variables should be shot, especially because it makes me read the question wrong.

Ronald Hensbergen

Help us, help yourself... Post data so we can read and use it: http://www.sqlservercentral.com/articles/Best+Practices/61537/
-------------------------------------------------------------------------
2+2=5 for significant large values of 2
Post #705773
Posted Tuesday, April 28, 2009 7:51 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, December 19, 2014 4:08 PM
Points: 2,396, Visits: 18,069
Hey Ronald - do you have a statistics background? I just noticed your sig line and it reminded me of an old statistician joke... :)
Post #705833
Posted Tuesday, April 28, 2009 10:34 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, August 28, 2014 8:53 PM
Points: 1,388, Visits: 3,039
Like Ronald, I doubt I'll have much use for a "text" datatype, but we do have XML in our databases so this QOD was valuable to me in pointing out that non-comparable datatypes are ignored. This script is modified from the original QOD to show the danger of depending on checksum or binary_checksum to flag certain changes.
Declare @FirstCksum int
CREATE TABLE #myTable (column1 xml,column2 int);
INSERT INTO #myTable VALUES ('<test></test>',109);
select * from #mytable
SELECT @FirstCksum = BINARY_CHECKSUM(*) from #myTable;
update #myTable set column1='<test>values</test>' where column2 = 109
select * from #mytable
SELECT Case when BINARY_CHECKSUM(*) = @FirstCksum
then 'No Change'
else 'Table Modified'
end as TableChanged
from #myTable;
DROP TABLE #myTable

Yes, it returns "No Change" because only the int column is considered by the function.
Post #706068
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse