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
 select data From 2 different Servers

Author  Topic 

xhostx
Constraint Violating Yak Guru

277 Posts

Posted - 2012-08-13 : 10:04:03
Hi,

I'm accessing 2 different servers at a time; one is local and second is remote.
anyone provide a sample select please.
I tried this the remote server: IT DID NOT WORK
SELECT TOP 1000 [Chassis]
,[PartNumber]
,[Descreption]
FROM (local).[Northwind].[dbo].[TABLE$]


--------------------------
Joins are what RDBMS's do for a living

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-13 : 10:08:39
you should add remote server as a linked server before you use query like above

see below to understand stpes of creating a linked server

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=164892

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

xhostx
Constraint Violating Yak Guru

277 Posts

Posted - 2012-08-13 : 16:09:48
Thanks Visakh!!!
but I got this error:
Msg 18452, Level 14, State 1, Line 1
Login failed for user 'CFLEF\USERID'. The user is not associated with a trusted SQL Server connection.


--------------------------
Joins are what RDBMS's do for a living
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-13 : 16:10:36
you need to map use login to linked server. see the step in article which explains user mapping

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -