SQL Server Performance

Attempting to Query Data from 2 different servers based on contents of first query

Discussion in 'SQL Server 2005 Integration Services' started by tthomasol, Apr 10, 2008.

  1. tthomasol New Member

    I am so frustrated, what I'm trying to do seems like it should be so easy but I can't figure out how to pull it off.
    I have Server1 with an Old Invoice System
    I have Server2 with a New Invoice System
    I want to maintain a read only copy of data from several tables from Server1 on Server2 for use with the new system. Server1 is not offline however and I need to make sure that any new data is moved over to Server2. My plan is to use a TimeStamp Field on the tables in Server1 that I need to keep synced with server 2. I want to use a SystemSettings Table in Server2 that stores the last TimeStamp used from the last import from Server1. I then want to do a lookup into Server1 for any rows in my table that have a TimeStamp greater than the last one stored in SystemSettings in Server2. Seems Easy enough, but I can't figure out how to use the value I obtained from the SystemSettings (Last TimeStamp) table to do a lookup on the old table in Server1. Can someone please point me in the right direction here? My head hurts from hitting the brick wall and I'm starting to think of ways to do this outside of SSIS.
  2. MohammedU New Member

    If I understand your question correctly...I will the following...
    Create a linked server from Server2 to Server1.
    Insert into dbo.Tablename
    select * from server1.dbo.tablename
    where timestamp > (select max(timestamp) from SystemSettings)

Share This Page