How to convert entire column of data table from string to int

How to convert entire column of data table from string to int?

Hi @Surya_Narayana_Korivipadu

If you want to change the datatype of a column in datatable from string to integer:

Create a variable like this:
image


Set CloneTable = your_datatable.Clone() in an Assign activity


Use InvokeCode activity:

Argument Setup
image


Code:
in_CloneTable.Columns[in_ColumnIndex].DataType = typeof( Int32 );


Use a For Each Row activity to loop your_datatable:


To check if the datatype has changed print:
CloneTable.Columns(column_index).DataType


1 Like