getting data froma different server

Posted on 2005-05-04
Last Modified: 2008-02-01
I have this code to get a records from a different server.  The name of the server is sqlclust.  When I run the following code and modify the code "sqlclust.Canondn.dbo.vre-----------" i get an error saying i have to run sp_addlinked server.  I am not familiar with that.  How do I modify the code below to  get the records frm the db called canondn that resides on server sqlclust.

SELECT     d.Model, d.Ref_ID, Customer_Name_ID as Customer_Name_ID, @SID as SourceID            
FROM          Canondn.dbo.vreferral_for_CustomerMaster  d
               Inner Join tblCustomer_Name c On
            @Sid = c.SourceID
            and d.Ref_ID = c.R_CustID
WHERE d.Model is not null AND d.Model <> ' ' and CMRecord is Null

thank you
Question by:krbnldy
    1 Comment
    LVL 21

    Accepted Solution

    You must set up a Linked Server either in Enterprise manager or by running sp_addlinkedserver in QA.  You have to define security and connection parameters before you can start querying across SQL Servers.  The code above will not work until after you create the LS.  And you may need to use [sqlclust].[canondn].[dbo].[vreferral_for_customer_master] instead....

    See "How to set up a linked server (Enterprise Manager)" in Books Online

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    CDC audit 17 67
    ODBC Informix Driver 11 72
    .mkt file extension?  FoxPro or something else? 6 79
    database design 10 80
    Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
    Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now