Avatar of AutomaticSlim
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??
Microsoft SQL Server

Avatar of undefined
Last Comment

8/22/2022 - Mon

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?


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

Your help has saved me hundreds of hours of internet surfing.
Scott Pletcher

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

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