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 lots of indexes) in another database in the same SQL Server instance.
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
Which takes, approximately, forever (1 hour for 10 million records, while it took 20 minutes to do it from the table with indexes to the one without them).
What's the best way to do this?
Thanks!