Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ADO: Can I SQL Join tables in two different databases?
Message
De
12/01/2001 18:53:27
 
 
À
12/01/2001 16:46:00
Information générale
Forum:
Visual Basic
Catégorie:
Bases de données DAO/RDO/ODBC/ADO
Divers
Thread ID:
00463249
Message ID:
00463292
Vues:
16
>Old time VFP'er doing first job with ASP+VBS+ADO
>
>So far so good, but now I have to get data from a table in SQL Server, then get one (same) column of a table in another database and eliminate any record that appears in both sets.
>
>That should be fairly easy to do in TSQL but can I JOIN two tables in different databases? (i.e. two open ADO connections?) Somehow I don't think so. If that's the case, on to plan B: persist the first result set and query it against the second database. In VFP that is easy to do with a temporary cursor. How do I do that in vbs w/ADO?
>
>Any help appreciated.

There's a couple of routes by using linked servers:
- For frequent access to the query:
Select * From RemoteServer.myDatabase.dbo.myTable
(You can also use OPENQUERY with linked servers)

- If you seldom run the query then use OPENROWSET as in:
SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'c:\MSOffice\Access\Samples\Northwind.mdb';'Admin';'';Employees)

(this last example from books online)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform