I have a STG table where we truncate and load values into the STG table from 2 SRC tables daily. I created a Change flag (Ch_Flg) and in the STG table so that instead of truncating the tables daily, we will insert values into STG only when certain fields in SRC have changed.
However, since SRC table loads directly into STG, I need a temp table in between where I can store all the SRC records and check with STG if the records have changed and insert into STG only when those records have changed.
For example the SRC1 table has columns like (ID, Name, Tag, Sector, Dept, City, Phone, HireDate etc) and SRC2 has columns like (ID, Name, Competency, City, Phone etc)
Should I load all the values from SRC into a temp table and then compare them against the STG table? Or is there a more efficient way to do this?