Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SELECT across databases
Message
From
23/08/2004 12:42:41
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
23/08/2004 12:20:14
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00935612
Message ID:
00935618
Views:
15
>This may seem naive, but this is the first time I have had a situation where I need to create an SQL statement that references data in 2 SQLServer databases. Using VFP to programmatically create the SQL statement and ODBC with SPT to execute the command, is it possible to SELECT data from tables in one database where the records match some criteria pulled from a second database.
>
>Example: SELECT db2.data from sometables where db2.sometables.criteria = db1.someothertables.id's.
>
>I know about normalization and realize that it would be easier to store the db1 id's in the db2 but that really won't work in this application for a number of reasons.
>
>Is this possible?
>
>Paul Montgomery

Yes, qualify the tablename with its database. ie:
select t2.field from db2..tableX t2 
 inner join db1..TableY t1 
 on t2.SomeIDField = t1.SomeRefIDField
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform