Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Joining table for another SQL Server DB
Message
From
21/03/2019 13:49:16
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01667405
Message ID:
01667477
Views:
47
>>>In my case all tables, MyTable, MyTable1, MyTable2, and MyTable3 exist in both databases. It is just that some customers, instead of using the table in their "own" database, use it in another database. This is why I want to explicitly have the db name prefix for all tables that are not in the default database.
>>
>>The more it makes sense to mention the OtherDb.dbo. prefix only once and use aliases down the road. Then if you need to change something, you change it in only one place (i.e. if you want to remove the prefix) and the command remains just as (un)readable as before.
>
>This alias is a property of the application object. So, no matter how many places I use it, I only need to change it once in this property (on the start of the application).

No, no, I meant the *local* aliases inside the sql statement - once you say TheOtherDb.dbo.myTable2 as t2, t2 is your local alias for the rest of that statement. And no matter how you change the from table but keep its alias, the rest of the statement can remain unchanged.

The alias of the resulting cursor is, then, outside of scope for this discussion, it applies when this SQL command returns results.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform