I have 3 tables:
- Staging: that gets employee records inserted every month.
- Master: table has contains all previously entered records from staging, unique records.
- Changes: keeps track of all changes - has no primary key.
The tables have 10 columns. In the staging table, every month we have about 2,500,000 records. Using a cursor I am able to insert new records from staging into the master table.
When it comes to update, I am using an inner join to get the records from staging that already exist in the master table.
To find out if any of the employee info has changed, do I have to query something line this:
WHERE Staging.FirstName <> Master.FirstName
OR Staging.LastName <> Master.LastName
OR ...
And so on for 10 columns, or is there an easier way?