Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to use two database in one script?


Hello everybody,

I want to use two database in one script? It is possible? I need it because our company have two different plants with different plantkeys and different database.

Now I use like the picture:

two database.JPG.jpg

The problem I have only the data of the second plant.

What can I do?

Thanks for your help.

greeetings sven

3 Replies
tresesco
MVP
MVP

Hello Sven,

Try like this:

ODBC CONNECT TO <First connection string>;

Script here to load from first DB;

DISCONNECT;

ODBC CONNECT TO <Second connection string>;

Script here to load from second DB;

cesaraccardi
Specialist
Specialist

Hi Sven,

You can load data from as many databases as you want, but keep in mind that you are only allowed to work with one at a time. So, for what you are trying to achieve you need to do like:

1. Connect to database A

2. Load data from database A

3. Connect to database B

4. Load data from database B

If the loads have the same structure (number of fields, name of the fields) the data will be concatenated and a sigle table with information from both databases will be created.

Hope that helps,

Cesar

Not applicable
Author

Hey Sven Arnold,

A "QVD Generator", or better a QVD layer, is probably a good idea in your case.

Cheers

Juan Pedro