SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Evangelist
    Join Date
    Jun 2001
    Location
    London
    Posts
    423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using joins in multiple databases - possible?

    Hi,
    Somewhat related to my previous post... , is it possible to join tables that exist in separate databases but reside on the same MS SQL server?

    For example, database one has the company and user data, whilst table two has the client core data...

    Regards

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,250
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    yes it's possible
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    va
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, you can do it, but you have to create a database link. Here is the link:
    http://msdn.microsoft.com/library/de..._adda_8gqa.asp
    http://www.GeekGig.com - Resources for the Geeks!

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,250
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    webjunkie, it's not that hard

    databases on the same server can be accessed like this --

    select foo, bar
    from database1.dbo.table1
    inner
    join database2.dbo.table2
    on ...
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #5
    SitePoint Evangelist
    Join Date
    Jun 2001
    Location
    London
    Posts
    423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks so much for your feedback much appreciated..



Bookmarks

Posting Permissions

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