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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How to Execute Server2 DB data from Server1

Author  Topic 

crsiva07
Starting Member

1 Post

Posted - 2008-07-31 : 09:45:25
I have a script which will have Current Employee details in Server1 also i have History of Old Employee detail DB in Server2(which is in different Box), am trying to access Server2 information from Server1 query analyser using SQL Server 2005.
Ex:
Connect SQL server 2005 query analyser and Connect to Server1
Server Name : Server1
DataBase Name : Employee_Detail

Server Name : Server2 (which is in different Box)
DataBase Name : Old_Employee_Detail

so from query analyser i can do like this
USE Employee_Detail

Similarly i want to access the Server2 table data from Server1, so try like this
USE Employee_Detail.Old_Employee_Detail

Its throwing error message like "No entry found with that name. Make sure that the name is entered correctly."

Can any one please give the solution.

Siva

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2008-07-31 : 09:50:53
Just add the server name to the table (not the USE)

select * from [Server2].[dbo].Employee_Detail.Old_Employee_Detail

Jim
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-07-31 : 09:53:28
Setup linked server first.
Go to Top of Page
   

- Advertisement -