Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Connecting to multiple OLE DB servers with a loop.

Hello all,

I am trying to run the same load script on multiple database servers without having several OLE connection strings with the same load statement copied / pasted.  This of course makes changes to the load script difficult to manage.  I would like to store the server names in a external file (excel?), and then execute the load using a server name variable in the connection string with a loop for each server name listed.  To keep the results seperate for each server, I will store the results by appending the server name variable to the file qvd file name.

Any ideas on how to pull off the loop?

Thanks in advance.

3 Replies
marcus_sommer

This is an example for different databases in multiple subfolders, but the logic should also worked in your case:

for each varPath in 'folder1', 'folder2'

     ODBC CONNECT32 TO [Microsoft Access-Datenbank;DBQ=D:\$(varPath)\Datenbank.mdb];

     table:

     Select ...

     DISCONNECT;

Next

- Marcus

Not applicable
Author

I got it working using something similar.  Thanks Marcus.

cristian
Contributor
Contributor

hello

can you tell me your's solution?

i have something similar and i can't find a way