SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 retrieve data from other server
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

eugz
Posting Yak Master

195 Posts

Posted - 11/08/2012 :  14:41:17  Show Profile  Reply with Quote
Hi All.

I would like to retrieve data from database of other server. If is it possible how to do? For instance, I would like to take data from server CVM.cx.sa/sdf database ASdb and table Customers. I tried like

Select *
from [CVM.cx.sa/sdf].ASdb.Customers

When I run that select I got error message:
Could not find server 'CVM.cx.sa/sdf' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers.


Thanks.

Edited by - eugz on 11/08/2012 15:40:45

sunitabeck
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 11/08/2012 :  16:09:26  Show Profile  Reply with Quote
You need to link the remote server - see here for a description http://msdn.microsoft.com/en-us/library/ms188279.aspx

You can use the following queries to find the linked servers and the logins:
SELECT * FROM sys.servers 
SELECT * FROM sys.linked_logins
Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22772 Posts

Posted - 11/17/2012 :  04:47:29  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
Have you tried this?

Select *
from [CVM.cx.sa/sdf].ASdb.user_name.Customers

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000