Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 retrieve data from other server

Author  Topic 

eugz
Posting Yak Master

210 Posts

Posted - 2012-11-08 : 14:41:17
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.

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-11-08 : 16:09:26
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

22864 Posts

Posted - 2012-11-17 : 04:47:29
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
   

- Advertisement -