Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2013
    Posts
    31

    Unanswered: Linking two Data Base in one server SQL 2008 R2

    Hi All ,

    I am just wondering if any one can help please , I have two SQL queries running on one server but different databases names

    Database 1
    Database 2

    Database 1
    Customer Table
    Customer ID :Primary Key

    Database 2
    DeliveryDetails Table
    Customer ID :Foreign Key

    I want to connect this two database in one server then connect this two Query using Customer ID
    Any help or suggestions much appreciatted

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Use 3-part naming:
    Code:
    SELECT db1_customer.list
         , db1_customer.of
         , db2_customer.columns
    FROM   database1.dbo.customer As db1_customer
     INNER
      JOIN database2.dbo.customer As db2_customer
        ON db1_customer.customer_id = db2_customer.customer_id
    George
    Home | Blog

Posting Permissions

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