I need to insert/update the table tbl_emp_payment from tbl_paymentsThis is kind of a daily process :Day1 - We will be inserting the values for the 'E123456' to tbl_emp_paymentDay2 - We will delete from tbl_payments and reload the second insert and now I need to update the pending amount in a different way Crieria : If any one of the value changes in the pending amount of the E123456 Then all the current amount should be populated in the pending amount where it is 0 and any thing greater than 0 should take only the pending amount Current amount is updated as it is Day 3:Now in Day3 we have one extra insert and one update So again for insert also it should meet the Day2 criteria where the new record has a value in the pending amount which is greater than 0 then it should update the pending amount(which is greater than 0) with the current amountcreate Table tbl_payment(emp_number Varchar(20) NOT NULL,payment_description varchar(10) NOT NULL,current_payment money NOT NULL,pending_payment money NOT NULL)create Table tbl_emp_payment(emp_payment_id INT IDENITITY(1,),emp_number Varchar(20) NOT NULL,payment_description varchar(10) NOT NULL,current_payment money NOT NULL,pending_payment money NOT NULL)Day 1:INSERT INTO tbl_payments( emp_number, payment_description, current_payment, pending_payment)SELECT 'E123456','COUNTY',456.78,0.00 UNIONSELECT 'E123456','CITY',893.56,0.00 UNIONSELECT 'E123456','STATE',234.34,0.00 UNIONSELECT 'E123456','MISC',789.78,0.00 Day2 :DELETE FROM tbl_paymentsINSERT INTO tbl_payments( emp_number, payment_description, current_payment, pending_payment)SELECT 'E123456','COUNTY',456.78,0.00 UNIONSELECT 'E123456','CITY',893.56,0.00 UNIONSELECT 'E123456','STATE',234.34,28.00 UNIONSELECT 'E123456','MISC',789.78,0.00 Day3 :DELETE FROM tbl_paymentsINSERT INTO tbl_payments( emp_number, payment_description, current_payment, pending_payment)SELECT 'E123456','COUNTY',456.78,0.00 UNIONSELECT 'E123456','LTG',389.23,73.00