Insert data from a table from one database to another databaseHi,
I have to write a stored proc, which will read teh data from one database table and insert into another database table if record is not in the destination table. both aource and destination table have same structure.
in my source db and destination db i have table structure like this
master table - pk - id
child table1 - fk - master id, pk- id
child table2 - fk - master id, fk- t1 -id,
child table3 - fk - master id, fk- t1 -id,
child table4 - fk - master id, fk- t1 -id
now in my destination DB i have to check if id from source master table exist
thn i have to check for this id in destination db i have records in child table1 for same date as for source child table1, if not then i have to insert data in child tables.
if id from master table dose not exist then i have to insert data into dstination Db for all teh tables.
Please let me know if i am not able to explain the scenario.
Thanks in advance.