Reputation:
We have an item cull that retrieves items and their appropriate data from one server. Their Primary Keys need to be INNER JOIN
ed with another table. However, the second table is on another server. We can retrieve that data using a separate select statement and accompanying VB objects.
How would one go about this programmatically in VB? Is a loop the best practice available? Although we are in a Microsoft Ecosystem, Server Linking is not possible.
Upvotes: 1
Views: 156
Reputation: 526
Use openrowset statement.
Syntax:
SELECT *
FROM OPENROWSET('SQLNCLI10',
'server=REMOTEDBSERVERNAME;database=DBNAME;uid=USERID;pwd=PASSWORD',
'SELECT * FROM table')
Try it.
Tiz
Upvotes: 1