|
-
Jul 31st, 2007, 03:43 PM
#1
Thread Starter
Lively Member
Possible to query another server?
Hi,
I was wondering if it was possible to query another SQL server that is on the same network. For example, I have
SQL1 - 192.168.1.50
SQL2 - 192.168.1.51
Can I query SQL1 from SQL2? If so, how? Thanks!
-
Jul 31st, 2007, 03:48 PM
#2
Hyperactive Member
Re: Possible to query another server?
Hmmm i think so, as long you can provide two connections
You mean....
Query from the SQL Query Analyzer?
from your application Program?
Complicated one is to do an inner join on both.... but i think programmatically you can....
Good luck!
-
Jul 31st, 2007, 03:57 PM
#3
Thread Starter
Lively Member
Re: Possible to query another server?
Sorry, I'll try to elaborate a bit more.
SQL1 - 192.168.1.50
SQL2 - 192.168.1.51
Using SQL1, I want to access data from SQL2. Here's the SQL statement I would use if I was in SQL2.
Select * From Lot Where LotNum = 'XXX'
I would find out what 'XXX' is from SQL1. I don't want to create another connection to connect to SQL2. Thoughts?
-
Jul 31st, 2007, 04:23 PM
#4
Re: Possible to query another server?
What is the backend database?
If this is MS SQL Server then you create a LINKED SERVER with ENTERPRISE MANAGER from SQL1 to SQL2 or the other way around.
-
Aug 1st, 2007, 08:59 AM
#5
Thread Starter
Lively Member
Re: Possible to query another server?
I think I was just failing to google the answer I needed. This is using MS SQL 2000. I was able to make a connection between the two by using
<server name>.<database name>.<owner>.<table name>
Hope that makes sense... thanks for the help everyone.
-
Aug 2nd, 2007, 08:33 AM
#6
Thread Starter
Lively Member
Re: Possible to query another server?
szlamany:
That's exactly the configuration that is in place now. I didn't know about linked servers until yesterday. Can you tell me if there is a reason why the connection would occasionally not work?
Currently, SQL1 is the dataserver and SQL2 is a PDF server (I don't know why it's done this way... but it's been in place for more than a year now). I need to extract the PDF from the PDF server through the dataserver. But for some reason, I get this SQLOLEDB error. It doesn't tell me anything else (I'm retrieving it using a ASP.NET 2.0 website). Thoughts? Or am I on the wrong forum for this question?
EDIT: I was trying to do the query in Enterprise Manager as well to see if it was a problem I had in the code. This is the error message I get from MS SQL.
[Microsoft][ODBC SQL Server Driver][SQL Server][OLE/DB provider returned message: Unspecified Error]
Last edited by Sedna; Aug 2nd, 2007 at 09:12 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|