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 2000 Forums
 SQL Server Development (2000)
 Querying a table on another server

Author  Topic 

msmcfadd
Starting Member

2 Posts

Posted - 2004-09-09 : 15:54:08
I’m trying to create a view to a table that is on a different sql server than the one my view is in. The problem I’m having is figuring out how to tell the view what username and password to use. By default it wants to use the username and password of the sql server that I’m writing the view in.
Here is the situation and a test I tried. There are 3 different servers (I will call them Server1, Server2, and Server3) I’m an admin on servers 1 & 2 and know that they both have the same password, that is why I can successfully run this view from Server1:
SELECT * FROM Server2.DBname.dbo.Tablename
But Server3 is owned by a different department so if I try this from Server1:
SELECT * FROM Server3.DBname.dbo.Tablename
It gives me an error saying invalid password for sa
This makes since because I do not know the sa password on Server3.
Is there a way I can tell the view the userid and password the other department set up for me to use on Server3 when it tries to link to Server3?
Mark

chadmat
The Chadinator

1974 Posts

Posted - 2004-09-09 : 16:05:15
When you configure the linked server there is a way to tell it what username and password to use.

Look at sp_addlinkedsrvlogin in BOL.

-Chad

http://www.clrsoft.com

Software built for the Common Language Runtime.
Go to Top of Page

msmcfadd
Starting Member

2 Posts

Posted - 2004-09-09 : 17:22:14
That was what I needed, Thanks Chad!
Go to Top of Page
   

- Advertisement -