Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

rename tables when loading

Hi - I'm REALLY new to QLIK

I have two tables ... searchengine1.system and   searchengine2.system

I have an ODBC connection to a SQL server

select  * from searchengine1.system;

select * from searchengine2.system;

I want the tables to be loaded; yet stay separate. Right now all of the data is getting appended into the first table because the field names match.

any ideas?

Thanks.

joanne

6 Replies

Re: rename tables when loading

May be do this:

QUALIFY *;

T1:

select  * from searchengine1.system;

T2:

NoConcatenate

select * from searchengine2.system;


UNQUALIFY *;

MVP
MVP

Re: rename tables when loading

you can use noconcatenate

t1: select  * from searchengine1.system;

t2: noconcatenate select * from searchengine2.system;

or Sunny's answer

or rename some or all the fields in one of the table

or add a field to identify the 2 tables when they are concatenated in one table

MVP
MVP

Re: rename tables when loading

Noconcatenate is, indeed, the answer, but I doubt if it can be appended directly to the SQL statement. It can, however, be added to the preceding LOAD statement in front of the SQL SELECT:

t1:

SQL select  * from searchengine1.system;



t2:

noconcatenate

LOAD

    *

;

SQL select * from searchengine2.system;

cheers,

Oleg Troyansky

QlikView Your Business: An expert guide to Business Discovery with QlikView and Qlik Sense

neetha_p
Honored Contributor

Re: rename tables when loading

hi Joanne,

If the two tables have the same field names then QlikView will try to join the tables on ALL of the fields.

(be careful of synthetic keys too )

Few of ways of fixing this are:

1. Use Noconcatenate keyword or


2.Rename the fields in one table or


3.Use QUALIFY keyword  to prefix the fields in your tables with the table name.

Regards

Neetha

MVP
MVP

Re: rename tables when loading

it works in my Qlik version 11.20 SR10

source2:  SQL SELECT * from .....;

Concatenate (source2) SQL SELECT *  from ..........;

MVP
MVP

Re: rename tables when loading

Yes, I just tested myself, and it works - most unexpectedly. We've been taught that SQL SELECT is performed on the database and therefore cannot use QlikView functions...

never stop learning...

Community Browser