Solved

binary checksum or checksum table

Posted on 2006-11-15
1
1,280 Views
Last Modified: 2008-02-01
Hi
What is binary checksum or checksum table and where can we use this.

Thanks
0
Comment
Question by:atwork2003
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 500 total points
ID: 17948441
Did u  check books online, there are few exampples given



A. Use BINARY_CHECKSUM to detect changes in the rows of a table.
This example uses BINARY_CHECKSUM to detect changes in a row of the Products table in the Northwind database.

/*Get the checksum value before the values in the specific rows (#13-15) are changed.*/
USE   Northwind
GO
CREATE   TABLE TableBC (ProductID int, bchecksum int)
INSERT   INTO TableBC
         SELECT   ProductID, BINARY_CHECKSUM(*)
         FROM      Products
/*TableBC contains a column of 77 checksum values corresponding to each row in the Products table.*/

--A large company bought products 13-15.
--The new company modified the products names and unit prices.
--Change the values of ProductsName and UnitPrice for rows 13, 14, and 15 of the Products table.*/
UPDATE   Products
SET   ProductName='Oishi Konbu', UnitPrice=5
WHERE   ProductName='Konbu'

UPDATE   Products
SET   ProductName='Oishi Tofu', UnitPrice=20
WHERE   ProductName='Tofu'

UPDATE   Products
SET   ProductName='Oishi Genen Shouyu', UnitPrice=12
WHERE   ProductName='Genen Shouyu'

--Determine the rows that have changed.
SELECT   ProductID
FROM      TableBC
WHERE   EXISTS   (
      SELECT   ProductID
      FROM      Products
      WHERE      Products.ProductID = TableBC.ProductID
      AND   BINARY_CHECKSUM(*) <> TableBC.bchecksum)

Here is the result set:

ProductID
13
14
15

0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question