SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Checksum givingtwo different values while Comparing VarBinay(MAX)


Checksum givingtwo different values while Comparing VarBinay(MAX)

Author
Message
vibin.das
vibin.das
SSC Rookie
SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)

Group: General Forum Members
Points: 45 Visits: 116
Hi All,

I'm facing a strange issue in my project.We are developing an windows application in which store the contents of (Word,Excel) in varbinary format in database(SqlServer2005).Our requirement is that we need to compare the current content of the word or excel with that of the content which is already saved in the database.If there is any change in the content then only i need to update the database,for this comparison we are using checksum.But the issue we are facing is that eventhough i havn't made any changes to the word document, on saving when i try to compare the previous value and current value using checksum in the database , it gives out two different values.Can anyone please help on this.

Thanks in advance,

Regards,

Vibindas
SQLogical
SQLogical
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 27
You can find a number of posts on this subject by doing a web search on "SQL Server Checksum false positives". Something related but not discussed as much are the rows that are different yet generate the same checksum value. SQL Server 2005 can generated checksums that are exactly the same in spite of the fact that the data is different. To try it for yourself:

CREATE TABLE DupeTest
(FieldA INT,
FieldB INT,
RowChecksum AS CHECKSUM(FieldA, FieldB))

INSERT DupeTest (FieldA, FieldB)
VALUES (384, 170005);
INSERT DupeTest (FieldA, FieldB)
VALUES (387, 170021);

SELECT * FROM dupetest

DROP TABLE DupeTest
J Livingston SQL
J Livingston SQL
SSCertifiable
SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)

Group: General Forum Members
Points: 5411 Visits: 35316
deleted: didnt read the OP question thoroughly !!

________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day

SQLogical
SQLogical
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 27
An interesting solution but adding another column, though guaranteed to be unique, cannot guarantee checksums that will always differ. As a matter of fact, given the original issue, it may even cause rows that differ and have different checksums to now have duplicate checksums.
David Dubois
David Dubois
Old Hand
Old Hand (318 reputation)Old Hand (318 reputation)Old Hand (318 reputation)Old Hand (318 reputation)Old Hand (318 reputation)Old Hand (318 reputation)Old Hand (318 reputation)Old Hand (318 reputation)

Group: General Forum Members
Points: 318 Visits: 220
If I understand your question:

You are saving a copy of an Excel spreadsheet (or Word document) to the database.
You then open that Excel spreadsheet, make no changes to it, and Save it.
You are now surprised that the checksum of the file is different than it used to be.

That's most likely because the files are different.

Just now I made a copy of an Excel file. (Just a plain file copy, nothing to do with SQL Server).
I opened that file in Excel.
I did absolutely nothing other then press Save, and then Exit.
I compare the file against the copy I just made, and I see that the file has changed.
It's not surprising that the checksums on the two files would be different, since the files are different, even though the two files hold the same "content".


Of course I've got free will. What other choice do I have?

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search