How to merge two databases in SQL Server?

后端 未结 6 1493
野性不改
野性不改 2020-12-16 03:42

Both databases have the same schema, but they may experience conflict with primary key in some tables. So I want them to just ignore the duplicate rows, and continue merging

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-16 03:57

    You could just add an additional field (called DatabaseID for example) to the all the tables in your merged database and add it to the Primary Keys. This way you can keep the original keys, while having unique keys in the merged database - and you can tell which database the row has come from. This is what SQL-Hub does - if it's just a one off job you can do this with the free trial.

提交回复
热议问题