Database Manipulations

Hi folks,
How can i move data from a table in one data base to a table in another data base.

@vishal.kp Hey, you can use this Query :innocent::innocent:
INSERT INTO dbo.TargetTable(field1, field2, field3)
SELECT field1, field2, field3
FROM SourceDatabase.dbo.SourceTable
WHERE (some condition)

2 Likes

@vishal.kp

You can use Database activity to do that.

image

For sample sql query, please refer at @supermanPunch reply

1 Like

Hi @vishal.kp,

I’ll suggest you to firstly get data from 1st database. I don’t know which database you’re using, but you’ve follow these basic steps.

  1. Get UiPath.Database.Activities package from manage packages.
  2. Use Connect activity from the same package to make a connection between database and UiPath Studio —> to specify database type and name.
  3. take Execute Query activity & configure connection by passing output variable of Connect activity in it.
    Sql query —> “select * from TableName”
    O/P variable will hold datatable.
  4. Once you have the datatable, you can now insert data row by row using Insert activity in For Each Row loop.
1 Like