Mismatch of Columns' datatypes of Datatable and Sql table

Hi,

Whenever I read data from excel sheet into the datatable with ReadRange actiivity, I get datatype of “object” for all the columns in Datatable. I can use the “preserve format” in Readrange activity but it is inefficient for very large data.

Now, I have different datatype of columns in my Sql table such as DateTime, string, Int32 etc. If I insert the datatable directly into Sql table then I will get the error of mismatch of columns’ datatypes.

I know one workaround i.e. to create a new datatable with the desired datatypes and then copy data from old datatable to new one row by row and then finally insert into the sql table.

My question is: Is there any other efficient way to insert data from datatable to sql table? Any help in this regard?

hi

There are two other ways

One is we can change the format of the column in excel directly
Or
We can change the column datatype of any column we want in the datatable with components

Please download the above package i mentioned, It has the activity called “Change Column Type”

After installing the package, Please drag and drop that activity and pass in the input data table to which the column type want to be changed and pass Column Index like {0,1,2,3} , If you want every column’s type to be changes mention every column index!! and Specify a Data table in output property and use it for merging!! You are done!!!

Cheers @WASEEM_KHAN