Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Fetching my tables is not working the right way

I have this five tables, where i want to insert in the QV so i can make my tables by them.

THE SCRIPT CODE:

OLEDB CONNECT TO [Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=PRIN;Data Source=AMRCCSLR835X0A\SQLEXPRESS;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=AMRCCSLR835X0A;Use Encryption for Data=False;Tag with column collation when possible=False];

SQL SELECT *

FROM PRIN.dbo."Presentaciones_Dolares";

SQL SELECT *

FROM PRIN.dbo."Presentaciones_Dosis";

SQL SELECT *

FROM PRIN.dbo."Presentaciones_Unidades";

SQL SELECT *

FROM PRIN.dbo."PROD_LAB_TIPO";

SQL SELECT *

FROM PRIN.dbo."Productos_Dolares";

SQL SELECT *

FROM PRIN.dbo."Productos_Unidades";

And when I hit Reload here is what happens:

If you can see, almost all the tables are being inserted into just one.

Help please.

1 Solution

Accepted Solutions
MVP
MVP

Re: Fetching my tables is not working the right way

QV auto-concatenate tables when these tables have the exact same field names.

You can prevent QV from doing this by using NOCONCATENATE LOAD prefix.

SELECT * FROM TableA;

NOCONCATENATE

SELECT * FROM TableB;

But if you load two tables non-concatenated with more than one common field name, QV will probably create a huge syn table.

So you should consider using

QUALIFY *;

SELECT * FROM TableA;

SELECT * FROM TableB;

Or rename your fields using AS

3 Replies
Not applicable

Re: Fetching my tables is not working the right way

scripting.bmp

here is the image, of the reload

MVP
MVP

Re: Fetching my tables is not working the right way

QV auto-concatenate tables when these tables have the exact same field names.

You can prevent QV from doing this by using NOCONCATENATE LOAD prefix.

SELECT * FROM TableA;

NOCONCATENATE

SELECT * FROM TableB;

But if you load two tables non-concatenated with more than one common field name, QV will probably create a huge syn table.

So you should consider using

QUALIFY *;

SELECT * FROM TableA;

SELECT * FROM TableB;

Or rename your fields using AS

mov
Esteemed Contributor III

Re: Fetching my tables is not working the right way

In general, it is not a good idea to use SELECT* FROM.

First, you're probably loading some fields you don't need,

Second, if something changes in database (new fields, removed fields) - the script will work but you may get an unexpected result.

Third, it is harder to troubleshoot - see your own example.

Forth, it is harder to maintain.

...

Regards,

Michael

Community Browser