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!
Printable View
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!
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!
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?
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.
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.
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]