Comapre two datatable variables

Hi Everyone,

Hope you’re doing good!

I have a automation which output will be 2 data table variables(dt1, dt2) and that variables contain date. I want to sort out the dates which are present in dt1 and not present in dt2.

What is the effective way to achieve this.

thanks in advance!


Try this


This works if we need to compare all columns…if not we need to go with data sepecific methods using linq



Use below query in assign activity

resultDt = (From row1 In dt1.AsEnumerable()
Where Not dt2.AsEnumerable().Any(Function(row2) row1.Field(Of DateTime)(“DateColumnInDt1”) = row2.Field(Of DateTime)(“DateColumnInDt2”))
Select row1).CopyToDataTable

This Assign activity will execute the LINQ query and store the result in the resultDt DataTable variable, which will contain the dates from dt1 that are not present in dt2.