Updating a table based on condition I have a database having a staging_table.
From this table, entries are added to other table named Profile.
Whenever staging_table is updated, it checks whether all its entries are present in Profile, if any is not present, add it to profile.
Till, here its fine.
Now I want that even if an entry exists in Profile, there might be a condition where some fields in Profile have been changed. So also want those entries to get updated.

Requirement: I cannot use any flags or any other table to check for its update.

Should I compare all fields? But that is very in-efficient.
Please tell me, what should be the most efficient method that I should follow to achieve this?

Thanks
To make an efficient compare of all columns between 2 tables, you could use a UNION method with GROUP BY as described in Diff2Tables. Alternatively, if your profile table can have rows deleted from it without cascade delete, you could, drop indexes that are not for PK of the profile, Delete rows having the same key in both tables, and insert the rows from the other table into the profile then re-build the indexes on the profile table again. This may sound bad but in fact it is not that bad. This is a typical scenario in Data Warehousing.