I have a really huge table on SQL Server with ~1 billion rows, we need to migrate data from this table to another with such a simple code:
SET XACT_ABORT ON
BEGIN TRAN
INSERT INTO TargetTable
SELECT Col1, Col2, ... ColN
FROM
HugeTable ht
INNER JOIN AnotherHugeTable aht ON aht.ID = ht.ColN
WHERE ColX IS NOT NULL
COMMIT TRAN
is it going to be OK to make it in single transaction? How would you go about it in this situation?