I ran into a problem where I was unable to move data from one database to another in one INSERT INTO statement. I used the statement below to cut up the data into more manageable batches. This script allowed me to reliably move 5 million rows:
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TempHolding]') AND type in (N'U'))
DR0P TABLE TempHolding
SELECT Id INTO TempHolding
FROM Databasename.Schema.TableName
WHILE EXISTS(SELECT TOP 1 1 FROM TempHolding)
BEGIN
SELECT TOP 50000 Id INTO TempStaging FROM TempHolding
INSERT INTO DestinationDatabaseName.Schema.TableName
SELECT t.* FROM Databasename.Schema.TableName t
JOIN TempStaging m ON m.Id = t.Id
DELETE j FROM TempHolding j WHERE EXISTS (SELECT j FROM TempStaging p WHERE p.Id = j.Id)
DR0P TABLE TempStaging
END
DR0P TABLE TempHolding
Note: I had to change DR0P table into DR0P table because of a filter on my text editor.