Link to home
Start Free TrialLog in
Avatar of AutomaticSlim

asked on

Merge two tables

I have 2 tables in 2 separate databases called Authors with the following fields:
-AuthId(Identity Field)

The tables contain book authors from all over the world. One of the tables is North America and the other table is authors from rest of the world. There are many Authors with the same FName and Lname. The only way they are identified is by the Author. Now I want to merge this two tables with a Stored Procedure.

How do I do This??
Avatar of dhenson

Just for clarification....

Your not looking for a sql to join the two tables together in one result set, but rather a Stored Procedure to create an additional table (dropping if exists) that has all the records from both original tables?

Is that correct?

Did the seeds for the two tables overlap so that the AuthID's would not necessarily be unique?

Avatar of AutomaticSlim


Here is an Example:

Id     Fname      LName
1      James       Robertson
2      Mark         Jackson
3      Janet        Ciega

Id     Fname      LName
1      Adam       Pictch
2      Will          Steiner
3      Will          Steiner
4      James       Robertson

Note that James Roberston in Table2 is not same person as James Robertson in Table1.
Now I want to add Authtable2 to Authtable1

Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
what you suggested above works but now the relationships between my other tables gets unstable and some other issues that I didn't think of.
I guess I asked a question without thinking about it properly.........

Thanks for the help