all groups > sql server programming > april 2007 >
You're in the

sql server programming

group:

Table CRC or Checksum?


Re: Table CRC or Checksum? xyb
4/10/2007 8:56:46 PM
sql server programming:
On 4=D4=C211=C8=D5, =C9=CF=CE=E79=CA=B157=B7=D6, lucius <luc...@newsgroup.n=
[quoted text, click to view]

Yes,i think you can all a timestamp column.this column will update
whenever you update one row or insert one row.
Re: Table CRC or Checksum? Rahul
4/10/2007 9:42:48 PM
[quoted text, click to view]

Uri,

Can you describe checksum, checksum_agg functions in brief.
I already check BOL, but really i have not understood that points.

Rahul
Table CRC or Checksum? lucius
4/10/2007 9:57:49 PM

I would like to determine if a table has had any changes to any row
since the last time I checked. The table undergoes a heavy series of
updates at irregular times (a result of a seperate batch system), and
I would like to quickly poll the table every n minutes to see if
things have happened to it. Is that possible?

Thanks.

Re: Table CRC or Checksum? Uri Dimant
4/11/2007 12:00:00 AM
Hi
checksum
This function computes hash value. I used '*' as argument to meant that
computation is over all the columns of the table.
checksum_agg functions
This function returns checksums in groups as BOL describes it. If something
has changed in the table then checksum's value will be changed also


[quoted text, click to view]

Re: Table CRC or Checksum? Russell Fields
4/11/2007 12:00:00 AM
Rahul,

You will notice that Uri's first sample said that if the checksums were
equal they were "probably the same". You need to determine if 'probably' is
good enough for your needs.

This is because a checksum is only an integer and because the algorithm uses
Exclusive ORs it is fairly easy for non-identical data to result in
identical checksums. If you Google around there are examples of this
problem, including this simple example from David Portas:
SELECT BINARY_CHECKSUM('ABA'), BINARY_CHECKSUM('ACQ')


Result:

----------- -----------
17761 17761

RLF

[quoted text, click to view]

Re: Table CRC or Checksum? Uri Dimant
4/11/2007 7:19:04 AM
Hi
if (select checksum_agg(checksum(*)) from t1)
<> (select checksum_agg(checksum(*)) from t2)
print 'different'
else
print 'probably the same'




[quoted text, click to view]

RE: Table CRC or Checksum? changliw NO[at]SPAM online.microsoft.com
4/16/2007 3:34:53 PM
Hi, Lucius,

It is a good way to combine Yuanbo and Russel's suggestions together. Could
you please let me know if you need furhter assistance on this issue?

Have a good day!

Best regards,
Charles Wang
Microsoft Online Community Support
=====================================================
Get notification to my posts through email? Please refer to:
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications

If you are using Outlook Express, please make sure you clear the check box
"Tools/Options/Read: Get 300 headers at a time" to see your reply promptly.


Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
======================================================
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================


AddThis Social Bookmark Button