Home Forums SQL Server 2008 SQL Server 2008 - General Required to update one table form another table from a different databse and different server RE: Required to update one table form another table from a different databse and different server

  • The simplest (but somehow not recommended) solution would be to create a linked server to DPROSQL in FS3.

    Then you could simply issue this:

    UPDATE AF

    SET AF.SomeColumn = SO.SomeColumn

    FROM [dbo].[AcquiredFrom] AS AF

    INNER JOIN DPROSQL.DCP_PROD.dbo.source_office AS SO

    ON AF.Code = SO.SourceCode

    Linked Servers however are not recommended for this kind of operation due to performance issues (the remote table is usually downloaded to tempdb with no index whatsoever, so you can imagine the pain joining big tables).

    Another option is to download the contents of the remote table to a table in tempdb that you control (so that you can have indexes and whatever is needed).

    Once your data is in the temporary table, you can use the usual JOIN queries to identify missing/nonmatching rows and do the needful.

    The process of importing the data can be accomplished with a SSIS package or with Import/Export wizard (which is SSIS under the covers).

    If you need more assistance with any of these steps, please let me know.

    -- Gianluca Sartori