Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2009
    Posts
    10

    Unanswered: select containing different servers

    Code:
    SELECT * FROM [server1].[Items].[dbo].[Properties], 
    [server2].[Items].[SpecialProperties]
    where Properties.ID=SpecialProperties.ID
    I am trying to do a select across 2 tables that exist on different servers, that are linked via the network. The above does not work;

    1. Should it work like this, i.e have I just made a spelling mistake etc.?

    2. ...or am I trying to fit a whale into a mini?

    Thanks

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    You're doing pretty well for a "first shot" at this. You missed the object owner for SpecialProperties. You MAY need to declare the linked servers if that hasn't been done yet. Otherwise you look like you're on the right track to me.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Oct 2009
    Posts
    27
    If you need help on how to set up the linked servers, here's an article that should be helpful:

    Setting Up Linked Servers

  4. #4
    Join Date
    Jun 2004
    Location
    Long Island
    Posts
    696
    Go with ansi standard.

    SELECT * FROM [server1].[Items].[dbo].[Properties] a
    inner join
    [server2].[Items].dbo.[SpecialProperties] b
    on a.ID=b.ID

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •