Both databases have a similar schema, however they can experience conflict with primary type in some tables. And So I would like them to simply disregard the duplicate rows, and continue merging further.

Best choice would most likely be using a third party application for example RedGate SQL Data Compare. Costs some cash, but it is worthwhile over writing that script IMO.

First a conflict of secrets signifies that whatever process you're presently using is really a poor one.

To properly merge two database that are using autogenerated (non_GUID) secrets, you have to take several steps. First give a new autogenerated answer to parents table, then import all of the data from both tables, relabel that old that old is file to ID_old and relabel the brand new files towards the old id title. You now may then move onthe the kid tables. You will have to copy to child tables by joining towards the parent table and using the new id area because the value for that foreign key rather than the main one within the existing table. You will have to continue doing this process for each foreign key table and when that table is another parent table, you will have to add the conversionid area towards the table before copying data, to ensure that you you are able to work completely lower the chain. To get this done correctly involves a lot of of knowlege from the structure from the database and a lot of planning. Don't consider carrying this out with no good backup of both source databases. It's also best when the process sometimes happens when both dabases have been in single user mode.

If you are using natural secrets and also have replicates, you've got a far different problem. All duplicate key records whould be gone to live in another table first along with a detemination regarding the more correct data ought to be made. In some instances you will notice that natural key is actually not unique (they rarely are and that's why I almost nver rely on them) and also the merged database will have to readily autogenerated key of some kind. This can involve code changes in addition to database changes, so it's a choice of last measure.

That which you find frequently with natural secrets would be that the data for each is different but simliar (St. vice Street within the address) within this situation mark among the records for place after which when perform the place in 2 steps, first the records without any replicates, then your records within the replicates table which are marked for insertion. Remember you'll have to examine all records in most foreign key tables to create the determination which to help keep and which to not keep. Just tossing out any replicates is an awful idea and you'll lose data this way, possibly critical data (like a customer's orders). This can be a lengthy tiresome process that will require someone with knowledge of the information to create the determinations. Like a programmer, you need to provide them a dedup tool which will allow them to examine all of the data for every group of replicates and select things to keep and things to eliminate after which getting marked everyithing, it'll operate a process to place the records. Recall inside your design, that for true replicates, you will see some child tables (for example orders ) that require the records from both delivered to the database for that record selected because the someone to enter (orders is definitely an example), for other tables you will need to determine which is correct (address for example). So that you can see this can be a complex process needing an intensive understanding othe database.

For those who have lots of replicates, they might be cleaning and adding the information for many several weeks, so something is actually critical. The folks this will be system customers not database specialists or developers because they are the only real individuals who truly could make the judgement the majority of the itme regarding which record to help keep. Likely you will have to make a move simliar the point is because there might be records that are replicates even if you come with an auto-produced key. They're just more difficult to get.

There's no good way to merge two databases (even using GUIDS, you will find the problem of replicates within the natural key).