Clone the data table structure

Suppose I have a data table with 5 columns (3 string,2 int32)
I want to get another data table with same headers and same data types
Can I get it Using Build Data Table

Hey @Sravya

DataTable.Clone Method():
Clones the structure of the DataTable, including all DataTable schemas and constraints.

Reference: DataTable.Clone Method (System.Data) | Microsoft Docs

Nop just crete a new variable of datatable type then use Assign activity like below :slightly_smiling_face:
DataTable newTable = originalTable.Clone()

Regards…!!
Aksh

14 Likes

Thank You.I will try.

Hi Aksh,
Suppose i want to copy all the data from one table to a new table, can below expression in Assign activity will do the work? Thanks!

DT.Select().CopyToDataTable.

You can use the Copy() method along with the Ui Path Assignment activity, i.e.
newDataTable = oldDataTable.Copy()

2 Likes