How to Change the Type of a Column in a datatable from String to Number?

Hello All,

I need to change the type of a column in a datatable from String to int32.
In my use I have to insert the datatable into a database table and the database table expects only int32 values for few columns.

I cannot use balareva packages in my project. Hence Please suggest me any alternate way to achieve this task.

1 Like

Hi

May be you can do like once after writing the data to a excel then you can use this macro to change the column format

Or

if you want to change it in datatable level itself as a int32 type then refer this

Cheers @Sirimalla_Karthik_Chandra

Hi @Palaniyappan , Thanks for replying to my post.

Using a Linq is a best approach for my usecase and I have to change the datatypes of more than 1 column. However I’m getting an error and I’m attaching the screenshot. I have gone through the entire thread but I didn’t understand how to handle the exception.

If possible could you please help me more in detail how to achieve my task.

image

In which activity you are getting this

Can you share the screenshot of that activity

Cheers @Sirimalla_Karthik_Chandra

@Sirimalla_Karthik_Chandra,

See if the below video helps.

https://www.google.com/search?q=uipath+change+datatable+column+type+site:forum.uipath.com&safe=active&rlz=1C1GCEA_enUS956US956&sa=X&ved=2ahUKEwioyLP56832AhWPg-AKHVvUCrwQrQIoBHoECBAQBQ&biw=1920&bih=937&dpr=1