Comaparing Datatables (multiple columns) i C#.net

Hi

I want to Compare datatable which have multiple Columns,

I need 3 datatable as table 3 result

@PriyaKannan24 Do you want to Compare the Datatables or Do you want to Combine the two Datatables, as the Result Datatable 3 looks like a Combination of first 2 Datatables :sweat_smile:

Yes i want to compare two Datatable and Datatable3 is resultant set

Datatable1 is new set of records coming always as fresh set
Datatable2 is existing record stored in db

While Comparing datatable 1 and datatable 2 i need to refain what are new set of records coming inside db(in Datatable3)

@PriyaKannan24 Can you Show us All the Columns of the Resultant Datatable 3, as the First Table contains Salary and Second Datatable contains Designation, So not sure what Schema do you want to keep in the Result Datatable

Hi @supermanPunch,

I need to compare User ID,Emp Name and Age columns alone from datatable1 and datatable2 and need to post to datatable 3 of all the columns from datatable 1

Hi @supermanPunch,

I hope so u can understand here clearly,

Table 1 have many Columns (10 Columns) (Data Comes in Job)

Table 2 - I used to populate using Select Query (3 Columns) (Ported Data from job)

AS unique Columns i am Comparing from Table1 and Table 2

Its like if record exists need to update if record not exist insert

Table 1 have many Columns (10 Columns) (Data Comes in Job)

Table 2 - I used to populate using Select Query (3 Columns) (Ported Data from job)

AS unique Columns i am Comparing from Table1 and Table 2

Its like if record exists need to update if record not exist insert

@PriyaKannan24 I guess you just need to Combine the the First 2 Datatables using Merge Datatable Activity, and then take the Unique Data in it, Have you tried that ? Considering the Column Names in the Two Datatables are having the same name, like “UserName” in First Datatable and “UserName” as well in Second Datatable if you are able to change the Column names then it would make it easy.

1 Like

Any Code Snippets Avaialble Ji