c# - Detecting and Updating a small number of changes in a table -


i have table of employees of company.

everyday, getting spreadsheet of latest list of employees of company. if person (based on ssn) in table not in spreadsheet, employee has left , enddate column in table updated. if person in spreadsheet not in table, new employee , has inserted. otherwise, existing employee, , 0 or more columns (eg telphone number, supervisor, etc) have changed , row in table has udpated.

given company size under 1,000 employees, , each day changes 50 employees, recommended way data refresh?

i understand there no 1 best solution, see creative implementations there out there. thanks.

sql server provides special merge command situations this.

you can use simple approach:

  • write content of entire spreadsheet temporary table
  • execute merge of employee table , temporary table using ssn match merge search condition
  • use when not matched source changing enddate
  • use when not matched target adding new employees
  • use when matched remaining updates.

Comments