Hello Guys,
I have two tables First One is.
tblSalaryMaster(salaryID,salaryName)
records are 1 Basic, 2 HRA, 3 Ca
and 2nd is tblSalaryDetailMaster(companyID,employeeID,salaryID,salaryAmount)
records are
1 1 1 10000
1 1 2 4000
1 1 3 3000
1 2 1 15000
1 2 2 7000
1 2 3 2000
and so on
now i add one more record to First Table 4 Allowance
as i am updating the second table now i want to compare first table values
with second table and if second table don't have the record(salaryID) then insert the record into
second table.
Please help me.
Compare two tables and insert the record
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Vishal GilbileRank #268 · 9.4K reputationPosted Mar 13, 2013, 10:01 PM EDT
If your are using oracle or Sql Server 2008 version you could easily make use of Merge Command to insert, update or delete rows from source table(First Table) or target table(Second Table).
Hope that solves your problem.
With Regards,
Vishal Gilbile.
Rakesh Kaushik29 reputationPosted Mar 13, 2013, 11:17 PM EDT
actually i am not updating the table from sql server query. i am updating the second table from c#.net form and please write a query how to do this.
Thanks in advance