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
Who is Participating?
Kevin3NFConnect With a Mentor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.