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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Query Multiple Servers with Different Logins
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

kimharlan
Starting Member

USA
9 Posts

Posted - 08/13/2007 :  10:45:02  Show Profile  Reply with Quote
Is it possible to query 2 different databases, residing on 2 different servers with different user credentials / SQL Login accounts for each, within the same SQL Stored Procedure, or even in-line? This is probably not possible, but I thought I would check. I am using .NET 2005 on the front end so I am guessing that I will probably need to create two different data sources in .NET, with different connection strings for each, and query each database individually, looping through the results to "add on" to my gridview dynamically. I was hoping for a more efficient way of doing this through SQL but I am guessing that it is not possible. The main issue is that the second database is managed by another department and our department won't want to share our account credentials with that department, which means I won't be able to use the same SQL login account for each database. Does this make sense at all? Does anyone know of any possible solutions? Thanks so much!

JoeNak
Constraint Violating Yak Guru

USA
292 Posts

Posted - 08/13/2007 :  16:40:04  Show Profile  Reply with Quote
You can set up a linked server to the other department's sql server and use the provided credentials. Once it's set up (and assuming the credentials have proper access) you can use 4 part naming on your server within your stored procedure to access data on the other server.
Go to Top of Page

kimharlan
Starting Member

USA
9 Posts

Posted - 08/14/2007 :  11:02:01  Show Profile  Reply with Quote
That's a great idea! Thanks! I don't know alot about linked servers but I am researching that now. I will have to see if I can get access to do that (on our server), as I currently am not able to even execute sp_addlinkedserver with my current permissions. Thanks again!
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.08 seconds. Powered By: Snitz Forums 2000