Assigning a new datatable from existing datatable and Modifying columns in newly created datatable reflects in the old datatable too

I have an existing dt with 5 columns, using assign i have assigned the value of dt to a new datatable dt_new. I have Modifying(deleted two columns) in newly created datatable dt_new and the same reflects in the old datatable dt too.
In dt alsi those two columns removed.

@cscrpa002 If you just want to remove the columns from the Datatable, and Assign it to a new Datatable, you can use Filter Datatable Activity, and specify the Columns you want to remove in the Output Columns Section.
Capture

1 Like

Then after deleting the columns from dt_new,
assign back to old dt as, dt = new_dt and check using write range whether dt_new and dt are same or not.

1 Like

That is the default behavior in .NET development, when you assign an object to another of same type, you are not creating a new one, just creating something like a link to the original object… If you want to copy the schema and data to a new Data Table, use DataTable.Copy instead.

Thank you

Thanks

Thanks. Got the solution based on copying the dt.

1 Like

I want to create a pivot table for that filtered columns only how could I do it.