• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 623
  • Last Modified:

getting data froma different server

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
1 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now