Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
cristian
Contributor
Contributor

Inline load multiple connection string for multiple sql server, for loading data from the same struc

Hello

I have a list of sql servers, and i have to load data from each other, they all have the same structure, with tiny difference in default database.

i want to find a way, to load inline the connection or any other way, to be able to make the script parameterized scrip

something like

load * inline [

par, string conection];

use conection

for i=1 to n

load * from conection{i}.table;

next

thank you

3 Replies
lironbaram
Partner - Master III
Partner - Master III

hi 

something like this should work for you 

connections:

Load * inline [

par, string conection];

 

for i=0 to noofrows('connections')-1 /////row index starts at 0 

let vConnectionString = peek('string conection',$(i),'connections');

load * from $( vConnectionString).table;

next

cristian
Contributor
Contributor
Author

hi

My script looks like this:

connections:

Load * inline [

par, string conection
1, CONNECT TO [Provider=SQLOLEDB.1;Persist Security Info=True;User ID=cristian.jugaru;Initial Catalog=BizPharmaFranciza;Data Source=x.x.x.x;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=DESKTOP-U59F549;Use Encryption for Data=False;Tag with column collation when possible=False] (XPassword is VIeZcSAJZbZGDABEQaMEXaMGAKJYH)
2, CONNECT TO [Provider=SQLOLEDB.1;Persist Security Info=True;User ID=cristian.jugaru;Initial Catalog=BizPharmaFrancizaFarmpil;Data Source=x.x.x.x;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=DESKTOP-U59F549;Use Encryption for Data=False;Tag with column collation when possible=False] (XPassword is KKFMVSAJZbZGDABEWKMYVXAIFBDA)
];

 

for i=0 to noofrows('connections')-1 /////row index starts at 0

let vConnectionString = peek('string conection',$(i),'connections');

load * from $( vConnectionString).table;

next

and i got the following error:

clipboard_image_0.png

cristian
Contributor
Contributor
Author

i think that my problem is that  it does not know when the connection string is ended.

how can i be sure that a string is exactly what i told him , because now, i think it does not stop at the "

thank you