fastest method to copy data from one table to another

  • what is the fastest method to copy data from one table to another table in a different database but on the same instance?

    a simple select * into db1.dbo.tablea from db2.dbo.tablea ???

  • Yes ....

    Although if table exists then you have to do

    INSERT INTO OtherDB.dbo.TableName

    SELECT ColList, ...

    FROM CurrentDB.dbo.TableName

    [font="Arial"]---

    Mohit K. Gupta, MCITP: Database Administrator (2005), My Blog, Twitter: @SQLCAN[/url].
    Microsoft FTE - SQL Server PFE

    * Some time its the search that counts, not the finding...
    * I didn't think so, but if I was wrong, I was wrong. I'd rather do something, and make a mistake than be frightened and be doing nothing. :smooooth:[/font]

    How to ask for help .. Read Best Practices here[/url].

  • To make it faster you can also make use of the non-logged or minimally logged operations to avoid writing into the transaction log if your business task allows that. Read this discussion:

    http://social.msdn.microsoft.com/Forums/en-US/sqldatabaseengine/thread/586a06ae-cf7e-4f82-8039-6952104f7992/

    Non-logged insert... select

    reply by Chad Boyd

    He explains that Select.. INTO is non-logged and also you can use OPENROWSET with BULK option (in SQL 2005).

    Check the prerequisites for the minimal logging at:

    http://msdn.microsoft.com/en-us/library/ms190422.aspx

    Regards,Yelena Varsha

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply