Skip to main content

how to Migrate one DB to another DB 

I need to migrate table record from one database to another databse throught AA in same server

 

when i try.  it enter the record in same table 

 

I need to enter the data in another table it is in another db kindly help me in this

 

You will need two connections: One for the source DB and one for the target DB. These connections need to have unique session names, e.g., “input” and “output” or “source” and “target”.

Once you have the connections active, it’s just like what you have above. You perform a SQL command to get all the table data from the source DB and loop through it, then you use Insert SQL commands to add that to the target DB.


Hi ​@Aaron.Gleason i have done but it shows error Kindly help me in this tell me in steps

 


That error means the syntax of your insert statement is incorrect. If you’re using a non-standard database (e.g., Excel), the syntax of the Insert statement can be different. Your bot looks correct; just check your SQL.


i am using MSSQL ​@Aaron.Gleason  and my query is

INSERT INTO Employee (EmployeeName, EmployeeAddress, PhoneNumber, Email, CreatedBy, ModifiedBy) VALUES ('$SQLDatasetRow{EmployeeName}$', '$SQLDatasetRow{EmployeeAddress}$', '$SQLDatasetRow{PhoneNumber}$', '$SQLDatasetRow{Email}$', '$SQLDatasetRow{CreatedBy}$', '$SQLDatasetRow{ModifiedBy}$');

Actually it work wrong in first it goes to same table

It was not Going to Insert in Another Table that is the problem sir 

and i am using one server 2 databse just trying to migrate the record from one table to another table


If it is going to the same table, you are referencing the incorrect session. That’s why it’s important to use names that make sense like “input” and “output”. Your screen shot cuts off the session name so I can’t check if that’s the issue.

 


now it is in the correct session ​@Aaron.Gleason kindly check it

It shows the same error

 


So you’re reading from the Employee table in line 3, then inserting into the Employee table in line 5? Did you mean to choose a different table?

Also, if you are copying data from one table to another on the same server, that can be done with a single SQL statement like this one (assuming the columns are identical):

insert into newtable select * from oldtable

Even if they’re not the same data order, you can execute a subquery to get the column order you need.

insert into newtable (a, b, c, d) values (select e, f, g, h from oldtable)


I am not copying just trying to move all the data and i am giving in the connect action the table name what is in the MSSQL and i am new to AA started practicing 1 month before kindly give me the flow ​@Aaron.Gleason 


Check this i have even mention table name ​@Aaron.Gleason 

 


First, there is nothing wrong with your flow. It should work fine. If you’re still getting errors, please contact your DBA and see if it is a permissions issue.

Second, you’re selecting from the employee table in line 3 and inserting into the employee table in line 5. That is probably not what you are intending on doing. You probably intend on writing data from one table to the other, in which case you must specify the source table in line 3 and the target table in line 5.


@Aaron.Gleason Thankyou


Reply