Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Leverage your QlikView investment to modernize BI – see how! Join Group
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Master II
Master II

concatenate two same tables with different schema

Hi All,

I have two same identical tables different schema. I want to store in a single QVD while loading.

How to achieve this.

Script:

ODBC CONNECT TO SCHEMA1 (XUserId is ZXSCDERS, XPassword is QAZSXW);

EMP1:

Load ENAME,

     JOB,

     DEPTNO,

     SAL,

     COMM ,

     'HR' as KEY;

SQL SELECT * FROM SCHEMA1.EMP;

ODBC CONNECT TO SCHEMA2 (XUserId is QWERDCS, XPassword is SXWSAS);

EMP2:

Load ENAME,

     JOB,

     DEPTNO,

     SAL,

     COMM ,

     'SALES' as KEY;

SQL SELECT * FROM SCHEMA2.EMP;

store EMP1 into QVD\EMP.qvd;

store EMP2 into QVD\EMP.qvd;

Capture.PNG

1 Solution

Accepted Solutions
Highlighted
MVP & Luminary
MVP & Luminary

Re: concatenate two same tables with different schema

Those table doesn't exists because qlikview concatenated automatically tables which have the same fields. I'm not sure if this also worked with those both preceeding loads - if your former load-script runs successfully and the table-viewer showed two EMP tables then not. If yes you will have only one table which you then could store as qvd. If not you need a noncatenate statement like this:

EMP:

Noconcatenate

load *  Resident EMP1;

concatenate

load *  Resident EMP2;


Store EMP into QVD\EMP.qvd;


- Marcus

View solution in original post

5 Replies
Highlighted
Master
Master

Re: concatenate two same tables with different schema

ODBC CONNECT TO SCHEMA1 (XUserId is ZXSCDERS, XPassword is QAZSXW);

EMP1:

Load ENAME,

     JOB,

     DEPTNO,

     SAL,

     COMM ,

     'HR' as KEY;

SQL SELECT * FROM SCHEMA1.EMP;

ODBC CONNECT TO SCHEMA2 (XUserId is QWERDCS, XPassword is SXWSAS);

EMP2:

Load ENAME,

     JOB,

     DEPTNO,

     SAL,

     COMM ,

     'SALES' as KEY;

SQL SELECT * FROM SCHEMA2.EMP;

//store EMP1 into QVD\EMP.qvd;

//store EMP2 into QVD\EMP.qvd;

TRY:

EMP

load *  Resident EMP1;

concatenate

load *  Resident EMP2;


Store EMP into QVD\EMP.qvd;


Highlighted
Master II
Master II

Re: concatenate two same tables with different schema

Thank you Neetha_p.

Will check and let you know.

Highlighted
Master II
Master II

Re: concatenate two same tables with different schema

Hi,

I got this error:

ScriptErrorDetails"EMP Table not found"
Highlighted
MVP & Luminary
MVP & Luminary

Re: concatenate two same tables with different schema

Those table doesn't exists because qlikview concatenated automatically tables which have the same fields. I'm not sure if this also worked with those both preceeding loads - if your former load-script runs successfully and the table-viewer showed two EMP tables then not. If yes you will have only one table which you then could store as qvd. If not you need a noncatenate statement like this:

EMP:

Noconcatenate

load *  Resident EMP1;

concatenate

load *  Resident EMP2;


Store EMP into QVD\EMP.qvd;


- Marcus

View solution in original post

Highlighted
Master
Master

Re: concatenate two same tables with different schema

Hi,

Yes use Noconcatenate,missed it.