Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SqlExec
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00651547
Message ID:
00651583
Views:
13
>Hi All:
> How do you combine two different connections from two different DSN into one in order to gather data from different databases. Fox example I want to form a join from two different databases and I am not sure how to accomplish this.
>Thanks

MA,
There are a number of ways to do this. Two of which are:

1. Combine the queries within the backend
Structure the SQL statement passed to SQLExec so that the backend connects to both databases and combines the query for you. If you can connect to both, it stands to reason that one of the backend servers should be able to connect to the other given the correct connection information. In SQL Server, this could be a Linked Server. If using Oracle, you could create a synonym to the other database. The query would have the appropriate alias/database.owner.table included in the statement to access the various tables.

2. Combine the queries within VFP
Create cursors via two separate calls to SQLExec passing the appropriate connection handle. Then join those two result sets together using another SQL statement with a UNION clause.

HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Reply
Map
View

Click here to load this message in the networking platform