Copy huge data tables from one database to another in SQL Server

I have two databases: DB_A and DB_B. In the DB_A database, the table has huge data (several tables contain from 2 to 10 million data). I want to move all the table data from DB_A to DB_B. Please help me write stored procedures in order to efficiently (quickly) transfer data from one database to another.

+3
source share
2 answers

The problem is how to process transaction logs. He should write for both, but you must process it in pieces.

So ... Try something like this:

While exists (select * from db1.dbo.tablename)
Begin
 Delete top 100 from db1.dbo.tablename
 Output deleted.* into dbo.tablename;

 Checkpoint; 
End
+2
source

, SQL Server, ?

Transactional Replication, , /.

, , " ", .

0

Source: https://habr.com/ru/post/1736630/


All Articles