Copy data between DBs on separate servers

  • Is it possible to do something like:

    [Code]

    BEGIN TRANSACTION

    INSERT into stagingDatabase.DestinationTable

    SELECT *

    FROM productionDatabase.SourceTable

    COMMIT TRANSACTION

    [/Code]

    when stagingDatabase is on server A and productionDatabase is on server B? (These servers are not linked, nor will they ever be.)

    Thanks!

  • You can't query a remote server without specifying a Linked Server, you will get an error that server is not in sysservers.

    Check for sp_addlinkedserver in BOL.

    After that you should not have any problem running a query similar to what you have posted.

    Make sure to use fully qualified name:

    [LinkedServer].[Database].[owner].[Table]

    hth!

  • You can look at using OPENROWSET function, look at link.

    Thanks.

    [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].

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

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