all groups > sql server programming > april 2004 >
You're in the

sql server programming

group:

How do I read records from databases in two different connections ?


Re: How do I read records from databases in two different connections ? Aaron Bertrand [MVP]
4/2/2004 6:38:35 PM
sql server programming:
If the two databases are on the same server, use one connection. e.g. if
you use cn1, then

sql = "SELECT column1, column2 FROM tablename t1 RIGHT JOIN
db2.dbo.tablename t2 ON t1.column1 = t2.column1"

(Note you will want to check your syntax, I spot at least a few errors
there.)

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


[quoted text, click to view]

How do I read records from databases in two different connections ? CobraStrikes NO[at]SPAM al.com
4/2/2004 10:53:35 PM
Hi I will be most grateful if any one can help me.
I have 2 connections to two different databases.
cn1 has database db1
cn2 has database db2

SQL = "SELECT field1,field2 FROM (db1 right join db2 on db1.field1=db2.field1)"

I get an exception error, I think it is because I am using two connections.
Can anyone tell me how to build the string ???
hope I explained well enough ?????
TIA


AddThis Social Bookmark Button