Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL DB Connection In ASP

Status
Not open for further replies.

Mugi

Technical User
Feb 14, 2003
2
AU
I have a situation where I have to refer to two tables in two DB's and create a single recordset for all the information.
I've tried to use two recordsets and use the info from the first for the second, but the problem is there are severl lines in the first table so I don't know how to include all the data in the second recordset's select statment.
I found an obscure mention of a 'View'
method in SQL but I don't know how to use it.
If you know, or think of a differnt way to cross-referance two tables on two different DB's Please let me know.

Have A Nice Day >:):O>
 
Hi Mugi,
If you are connecting to SQL 7.0 or above you can use the qualifiers for DB like,
SELECT * FROM myDB1..myTable1 WHERE ....
UNION
SELECT * FROM myDB2..myTabl2 WHERE ....

OR
SELECT A.col1, A.col2, A.col3, ..., B.col1, B.col2, B.col3
FROM myDB1..myTable1 A, myDB2..myTable2 B
WHERE A.<key>=B.<key> AND ....


These will return you single recordset from the backend itself.

Hope you got the idea.
Let us know, if you are using SQL lower version.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top