Field Value Comparison

Hi,

I want to compare field values of two datatable say dt1 and dt2 from sql server. After comparison if any field value is different then I have to copy that field from dt1 to another data table say dt3. Please help on this

Example:

dt1:
Name Country
Abc India
Xyz India

dt2"
Name Country
Abc Others
fgh India

In above scenario, 1st row has country different and 2nd row has name different So after comparison dt3 should contain as below

dt3:

Name Country
NULL India
fgh NULL

Dt3 should copy from dt1 always in case any field value is different. Also suppose Dt1 contains any null value then it should not compare with dt2. But if dt2 contains null value then it should copy that field from dt1 to dt3.

In a nutshell: any value which is different or blank in dt2 needs to output into dt3 with respective field value of dt1

I hope I made my question clear :slight_smile: