/*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)
(select * from a
minus
(select a.字段一,a.字段二,... from a,b
where a.字段一=b.字段一,...))
union
(select * from b
minus
(select b.字段一,b.字段二,... from a,b
where a.字段一=b.字段一,...))