Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Select with the second DB
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01683370
Message ID:
01683424
Views:
38
Understandable. I've had great success with remote views myself -- I use them even when connecting to local VFP data - that way if they ever want to switch to SQL Server all I have to do is copy the tables to SQL and change the connection string the remote views use and done :) I have another set of stored procedures & triggers in conjunction with remote views hat replicate any VFP data to a remote database like SQL Server which I use for live syncing VFP and SQL Server data. I actually have written a big wizard thing to set this up automatically -from any VFP set of tables - I really need to release that to the public domain one of these days it's really cool and I spent several years putting it all together lol.


>I don't use remote views. The entire application is built on CursorAdapter. I am sure some will say that remove views are better than CA. And yet, others will say that CA is better. If it works, why break it :)
>
>>What I've done in the past is use remote views for the different databases, then create a local view that contains the two remote views joined together -- I'm even doing updates this way. I have had others tell me that this is not necessarily a good idea -- however I've yet to ever have a problem doing it & been doing it for many many years. I actually have local view that contains remote views from DB2, MySQL, Oracle, two SQL databases and 2 VFP databases all wrapped into one local view lol.
>>
>>
>>
>>>Hi,
>>>
>>>I am working on modifying a SQL Select that pulls data from two databases.
>>>The first one is the default.
>>>The second database is specified in the variable cSecondDb. For example,
>>>
>>>cSecondDb = "SQLDbNo2"
>>>
>>>
>>>In the SQL select I put the variable cSecondDb as a prefix to the table that is in the second DB. Example:
>>>Table 1 is in the 1st DB
>>>Table 2 is in the 2nd DB
>>>
>>>select column1 from Table1 where column2 in (select Table2.pk_field from " + cSecondDb + "Table2" +  where 
>>>Table2.field3 = 'xyz'
>>>
>>>I know that the above is probably not well formed SQL Select. But my question is,
>>>Do I need to put the variable cSecondDb before EACH and every time the table in the second DB is used? Or just in the FROM clause?
>>>That is, do I need the cSecondDb before "select table2.pk_field" or by saying that I am selecting FROM cSecondDb + "table2" is enough?
>>>TIA
ICQ 10556 (ya), 254117
Previous
Reply
Map
View

Click here to load this message in the networking platform