I have this stored proc that is to look for changes only between 2
tables and inserts the changes into one of my temp tables that I later
delete in my DTS flow.
I am running into a problem I think becasue in my query I am joining on
fields that may not exist yet in one of the tables.
Is there a way to compare the 2 tables in the query without joining
them? Here is my current query:
CREATE PROCEDURE [DBO].[ChangesOnly] AS
INSERT INTO ResultSet ( CustomerNumber, CustomerName, AddressLine1,
AddressLine2, AddressLine3,
City, State, Zipcode, Division )
SELECT A.CustomerNumber, A.CustomerName, A.AddressLine1,
A.AddressLine2, A.AddressLine3, A.city, A.State,A.Zipcode, A.Division
FROM MyClone As A INNER JOIN tCustomers As B ON a.CustomerNumber =
B.CustomerNumber AND
A.customerName = B.CustomerName And A.Division = B.Division
WHERE
A.AddressLine1 <> B.AddressLine1 OR
A.AddressLine2 <> B.AddressLine2 OR
A.AddressLine3 <> B.AddressLine3 OR
A.city <> B.city OR
A.State <> B.State OR
A.Zipcode <> B.Zipcode OR
A.Division <> B.Division;
GO
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!