473,666 Members | 2,258 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CHECKSUM to determine record changes

I've searched the forum for uses of CHECKSUM and havent found a
satisfactory answer.
I need to know when a row changes and I dont care what it was or is, I
just need to know it changed.
Detail:
Hourly I select rows where the record as a create date or change date
of the last 3 days. I am only interested when the address or name
changes, not other columns.
Currently, I might select 30,000 rows that are new or changed, but
turns out that only 100 have address changes and 500 are new. I want
to process the 600, not the 30,000.
My main concern is if some columns change, but the resulting checksum
doesnt. Then I would have missed processing that record.
The column types that I will be tracking are:
"forenames" VARCHAR(50) NULL,
"surname" VARCHAR(51) NULL,
"ADDRESS1" VARCHAR(60) NULL,
"ADDRESS2" VARCHAR(60) NULL,
"ADDRESS4" VARCHAR(50) NULL,
"STATE" VARCHAR(10) NULL,
"ZIP" VARCHAR(20) NULL,
"email" VARCHAR(50) NULL,
"telephone" VARCHAR(10) NULL
(I left off the keys, these are the only fields that I will be using
for the checksum()).
Am I safe? I read about 32 bit CRC and some data changes would go
unnoticed, but not sure if this layout would qualifiy.

TIA
Rob
Jun 27 '08 #1
3 5513
Im using SQL Server 2005 currently patched.
Jun 27 '08 #2
"rcamarda" <ro************ **@gmail.comwro te in message
news:2d******** *************** ***********@k13 g2000hse.google groups.com...
Im using SQL Server 2005 currently patched.
CHECKSUM isn't a reliable way to detect change because it's quite common to
find different rows with the same CHECKSUM value. You could use a ROWVERSION
column instead. ROWVERSION is guaranteed to increment when the row data is
updated.

Another alternative is to use a hash. The HashBytes function will return a
secure hash of a binary value with a very high probability of uniqueness.
Duplicate hashes are theoretically possible but are incredibly unlikely to
occur unintentionally . If you are extremely paranoid then you can use two
different hashes.

--
David Portas
Jun 27 '08 #3
David Portas wrote:
>
"rcamarda" <ro************ **@gmail.comwro te in message
news:2d******** *************** ***********@k13 g2000hse.google groups.com...
Im using SQL Server 2005 currently patched.

CHECKSUM isn't a reliable way to detect change because it's quite common to
find different rows with the same CHECKSUM value. You could use a ROWVERSION
column instead. ROWVERSION is guaranteed to increment when the row data is
updated.

Another alternative is to use a hash. The HashBytes function will return a
secure hash of a binary value with a very high probability of uniqueness.
Duplicate hashes are theoretically possible but are incredibly unlikely to
occur unintentionally . If you are extremely paranoid then you can use two
different hashes.

--
David Portas
I agree about the advice for use ROWVERSION.

However, CHECKSUM is also just a hash. Whether the chance of an
unnotices change is lower if you use HashBytes function instead of
CHECKSUM depends on your data.

Although adding a second hash value will lower the chance of a missed
change, it would be silly to do so. In the end you would need as many
hash bytes as there are bytes in the data.

--
Gert-Jan
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
5917
by: Mercuro | last post by:
Hello i'm looking for a simple way to checksum my data. The data is 70 bytes long per record, so a 32 byte hex md5sum would increase the size of my mysql db a lot. I'm looking for something that is 5 bytes long, for the moment i'm just taking a part of the hex md5 sum (like this: checksum = md5sum). I
5
6008
by: David C. Barber | last post by:
I'm trying to determine which user has locked a given record from VB6. I know I can use sp_lock and sp_who, and match up the data to determine which users have locked records in my database, however I haven't seen a way to match the specific user to the specific record. What am I missing here? Thanks! *David*
7
2307
by: ajamrozek | last post by:
I'm developing a stored procedure to run an update based on values entered into a .Net web form. I want to capture the chceksum of the row when it is displayed on the form then validate that when the update is exec'd. Simple enough logic, eh? The problem is when I try to use the checksum(*) function, SQL server yells at me and says that it isn't recognized. I'm using SQL Server 7, so wtf? I am not the admin of the server and I'm...
6
4697
by: Astroman | last post by:
Hi guys and girls. This is my first time posting here so go easy :) . I was wondering if someone could please interpret how this csum() function works in the following C code. I know that the function returns the checksum value but I was wondering How. I only included the top half of the c code because you probably dont need the other half and also it is a syn flooding program so I thought I shouldn't post the whole lot. This is from the...
3
6532
by: Andrus | last post by:
Device connected to serial port accepts data packets in the form 02 0x57 ll ll 00 00 00 00 dd..dd cc cc 02 (1 byte ) is message prefix 0x57 (1 byte) is message type (W=Write) ll ll ( 2 bytes) are message data length 00 00 00 00 (4 bytes) seems to be constant zero bytes dd..dd ( ll ll bytes) is message content which I can vary. cc cc ( 2 bytes ) is problebly message checksum
2
10029
by: Jesper | last post by:
Gents, I need the checksum of an xml file in order to verify that no changes has been made to the file. How is this done. Second, is it possible to 'embed' the MD5 checksum inside the very same file. I guess not but perhaps if it is possible to make a partial checksum not based on the first X characters of the file. Thank you very
15
7780
by: ValK | last post by:
Hello, I’m working with handheld device that communicates with windows service thru the serial port. Transaction between device and my application looks like this: Handshaking: Device sends ENQ Service responds DLE 0 Device sends DLESOH4168840000SR01L01DLEETX4á
34
3806
by: Zahid Faizal | last post by:
Kindly suggest a good opensource package (in C or C++) that can compute the checksum of a file. SHA2 would be preferable, but SHA1/SHA0/MD5 would be acceptable as well. We have cards with different processors, running different operating systems, and we would like a package that provides the checksum value consistently across different processor architectures and operating systems. Zahid
3
6423
by: Kurt | last post by:
Hi, I'd like advices about an idea I add to resolve a problem. thanks to you in advance for yours answers. I have a database with tables that I load with flat file. The size of each table is 600 Mb. The flat file are the image of an application and there is no updated date or created date on any table. So my tables are just a copy of the data from the flat file. Now I'd like to create an History Table. So I have to determine which
0
8443
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8781
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8550
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7385
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6192
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5663
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.