Passthrough Question

T

TJ

In my DB I have ODBC connections that link up to different data sources. The
tables in each of these databases are enormous and I would like to cut down
query time by building some passthroughs. I know how to build passthroughs
that link to a single datasource but is it possible to link to two seperate
datasources within a single query? If so then what do you put in the
connection string?

-TJ
 
D

Duane Hookom

If your p-t is connected to SQL Server, you can run a select from a different
server with either a linked server or syntax like:

SELECT choChoID, choFacID, choLINNUM, choLINNAM, choARTNUMFrom,
choARTNAMFrom, choARTNUMTo, choARTNAMTo
,choPEHDAT, choPEHSTT, choGPH, choQty, choStopDuration, choLaborHrs,
choSTGNUM, choSTGNAM
,choComments, choLastUpdater, choLastUpdate, choCoSID
FROM OPENDATASOURCE('SQLOLEDB',
'Server=SERVERNAME;User ID=XXXX;Password=xxxx'
).SAMCorp.dbo.tblChangeovers
 
T

TJ

So If I wanted to join table A from server A to table B from server B then
would I use the same type of syntax as you listed below seperating the
OPENDATASOURCE command with inner join?
 
D

Duane Hookom

I believe this would work with a JOIN to a table from the current database
server.
You could create a view using the syntax I provided and then do a simple join.

I haven't tried this so let us know how it works out. I don't know how
efficient this is.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top