I have multiple Db with same table schema in all DB.
Now I want to globalization.
I create a new DB and create same table scema.Now,I wan't to insert all records from all databases and checked when data Insert if same name is exsist then Update else Insert.
For example,
DbName :- [Db1,Db2,Db3]
Table Name :- Tax
Column Name :- 'Name'
Records Count :- [5,2,3]
OUTPUT
DbName :- Global
Table :- Tax
Column Name :- 'Name'
Total Records :- 10
If Name is already exsist in Tax table in global DB then update else insert.
Note :- all DB is different but schema is same.
Suggest and give advice for above problem statement.

Jignesh KumarPosted Jan 9, 2024, 8:35 AM
Hello Jayraj,
You can achieve via Merge statement in SQL, Please refer this thread will help you,
https://www.red-gate.com/simple-talk/databases/sql-server/learn/manage-data-over-time-with-sql-server-merge-statement/
Anandu G NathPosted Jan 9, 2024, 4:23 AM
@Jayraj Chhaya
use bulk copy
Rajeesh MenothPosted Jan 8, 2024, 11:58 AM
Hi,
I have written an article on the same topic and you can refer :
https://www.c-sharpcorner.com/UploadFile/2a6dc5/how-to-copy-or-generate-sql-databse-content-to-multiple-one/
Naveen KumarPosted Jan 8, 2024, 11:58 AM
You can use the
MERGEstatement in T-SQL. TheMERGEstatement allows you to perform both INSERT and UPDATE operations based on a specified condition. You have to write a dynamic query since you have multiple DB's to iterate.Below the Merge example for a single table, which need to be modified dynamically to iterate for each databases and tables under it.