I'm basically trying to copy data from a table in one database in SQL Server 2005 to another table with the same structure (but with a large number of indexes) in another database in the same instance of SQL Server.
My current approach is the obvious INSERT / SELECT:
set identity_insert TargetDBName.dbo.TableName on
insert into TargetDBName.dbo.TableName ([FieldsList])
select [FieldsList] from TargetDBName.dbo.TableName
set identity_insert SourceDBName.dbo.TableName off
What is required is approximately forever (1 hour for 10 million records, while it took 20 minutes to do this from a table with indexes without them).
What is the best way to do this?
Thanks!
source
share