Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQLExec() SQL Select from 2 DB
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01654292
Message ID:
01654316
Views:
48
>>>>>Thank you. I may break the query just to be sure that the user has access to the second database. Also, I don't like to use the DB name in the query (it would be hard-coding it). I prefer to use a handle.
>>>>
>>>>Nope, you can not use handles.
>>>>You must use DataBaseName :-)
>>>
>>>I wonder if I can use a pseudo name for the DB so that I don't have to hard-code it in my query.
>>
>>Nope, you can't.
>>But you can create Synonyms in you database to create instance of table from other database and then use that synonym like table.
>
>Could you, please, give me an example on how to create a synonym?
CREATE SYNONYM schemaname.SynonymName FOR DataBaseName.Schema.TableName
Than you can use it:
SELECT * FROM YourTable
INNER JOIN schemaname.SynonymName ON ...
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform