Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Joining table for another SQL Server DB
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Joining table for another SQL Server DB
Miscellaneous
Thread ID:
01667405
Message ID:
01667405
Views:
62
Hi,

I have a situation where in the SQL Select, the JOIN should have a table (MyTable2) from another SQL Server database. Here is an example:
local cJoinSqlServer
cJoinSqlServer = "SQL2Name.dbo."
cSqlSelect = "select * from mytable join " + cJoinSqlServer + "MyTable2 on MyTable.pk_field = MyTable2.pk_field"
The above syntax works.
And then I tried to add the cJoinSqlServer to the ON part as follows:
local cJoinSqlServer
cJoinSqlServer = "SQL2Name.dbo."
cSqlSelect = "select * from mytable join " + cJoinSqlServer + "MyTable2 on MyTable.pk_field = " + cJoinSqlServer + "MyTable2.pk_field"
The above works too; no error. But do I really need to add this prefix (of the second SQL Server DB) to the ON part?
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Next
Reply
Map
View

Click here to load this message in the networking platform