Datatable comparison: Error displayed as Data tables must have the same structure

I have two data tables with the same number of rows and columns(cross-checked by printing them). But, I am getting error “The input data tables must have the same structure”.

Can somebody please explain what has went wrong?

buddy @rameshgp43
on using which activity you were getting this error buddy

Cheers @rameshgp43

Are the datatypes of each column also the same?

You have a string being compared to an Int32 data type for example

Do we need to match the data types as well?

because one data table is coming from Database and another from excel sheet.

Hi @rameshgp43 - I think you are trying to Merge the Data Table then Both the Column Header should be same rather than number of column or number of row.

Thanks,
AK

Buddy kindly check the name of the column matches or not buddy…you will be getting this error even of that doesnt matches while merging @rameshgp43

were able to do now buddy @rameshgp43

Hi What i am looking for is comparison and not merging

Fine …
May i know how you are trying to compare and at what activity you get this error buddy
Cheers @rameshgp43

I am using a Data comparison activity provided in uipath Go

link: https://go.uipath.com/component/compare-datatables

Scenario:

  1. The first data table is taken from the excel sheet using read range.
  2. The secon data table comes from database using “execute query” acitvity.

I tried converting all the cplumns to VARCHAR in the sql query and pass to the data table but, still no luck

Buddy @rameshgp43

I tried to use the same activity buddy, if the column datatype are not similar, this error will be thrown buddy…and try to convert as nvarchar and compare them buddy @rameshgp43

Cheers

Ok I will try and let you know

I tried it but not luck…

So, I changed the flow.

  1. Datatable 1 comes from the excel sheet named “rough” from A to H columns.
  2. Executed sql query, write the result in the same sheet from K to R columns.Again I am reading this same K to R as data table using read range. for Data table 2.

But, still it is not working. I printed both the data tables separately and confirmed that they are same.

Unable to find what is going wrong. I made sure that the whole excel sheet is formatted to ‘text’ as well

Hi Ramesh,

Try to save the SQL datatable to excel and read as datatable and compare with excel datatable and it should work.