on 12-11-2008 7:25 PM
Hi friends,
i need an sql query as my requirement was i have to retrieve data from 2 tables from one database and insert the same data to another two tables having the same structure in other database here my primary key was ID which was there in both tables.can any one help me on this issue.
Hi
Use JDBC to JDBC scenario.
JDBC Sender setting:Your Sender Structure would be same as for single table, only your select query would be like Select Emp.EmpName,Emp.SalAcc,Acc.AccountNo From Emp,Acc where Emp.SalAcc =Acc.AccountNo. here Emp and Acc are two table.
JDBC Receiver Sturcture : Use two Statement in your structure. Inside first Statement insert data into first table and other Statement to insert data into second table.
Note: look JDBC receiver structure there is StatementName.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,Dharma,
what u have said is correct i have done that one but we need to inserrt the same data to 2 tables in another database . here what i have to write in update sql statement in sender jdbc adapter. i have used the same query waht u posted but i will retrieve the data from the two tables later is has to insert into another two tables in other database.that is my requirement.
looks to be like JDBC-JDBC scenario. query the sdn..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Uday,
Just got a bit curious with this business requirement. You can join the table as the person has explained but you need to consider what would be your update query.
You will need to add a column "processed" in either of the table (assume table b) and update this to Y.
So in you select will be
select * from a, b where a.col1 = b.col1 and b.processed = 'Y' (I have specified a join not sure what you require)
Update statement should be
update table b set processed = 'Y'; (Ideally you should have a where clause as above)
regards
Unni
Edited by: Unni Krishnan on Dec 12, 2008 12:52 AM
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.