fmsol
asked on
SQL/ASP: Recordset from two different servers with vbscript
I have two different databases (both MS SQL Server) where I search for employees:
conn1.ConnectionString = (connectionstring to db on server 1)
conn2.ConnectionString = (connectionstring to db on server 2)
conn1.Open
conn2.open
sqlstr="SELECT employee.name FROM db_on_server1
WHERE employee.id IN (SELECT persons.id FROM db_on_server2 WHERE ...)"
Set rs = Server.CreateObject("ADODB .Recordset ")
rs.open sqlstr, conn1
Works fine when the two databases was on the same SQL server with just one connection string, but now one of them was moved to another server.
Is it possible to subquery like above, when the subquery targets a db on another server, or is there another way of doing this?
conn1.ConnectionString = (connectionstring to db on server 1)
conn2.ConnectionString = (connectionstring to db on server 2)
conn1.Open
conn2.open
sqlstr="SELECT employee.name FROM db_on_server1
WHERE employee.id IN (SELECT persons.id FROM db_on_server2 WHERE ...)"
Set rs = Server.CreateObject("ADODB
rs.open sqlstr, conn1
Works fine when the two databases was on the same SQL server with just one connection string, but now one of them was moved to another server.
Is it possible to subquery like above, when the subquery targets a db on another server, or is there another way of doing this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sorry Brandon, didn't see your post when I started responding to this question..
No big deal. You were typing while I was.
ASKER
Thank you both!
[server].[database].[owner
to reference the remote table in the subquery..