Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

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
Not applicable

Re: How to use two database in one script?

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
Not applicable

Re: How to use two database in one script?

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

Re: How to use two database in one script?

Hey Sven Arnold,

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

Cheers

Juan Pedro