Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Zorak
Contributor II
Contributor II

Adding a column on load script duplicate my table

Hi, Qlik! I'm tryng to add a column to an existing table, but after loading it its creating a new entirery table. I have something like this:

 

table_1:

select * 

from source

 

table_2: 

left join table_1

load *

select * 

from source2

 

here, one of the joined columns of table_2 is comming almost entirely null into table_1, and im trying to fix this as:

 

table_1:

load

*,

if(isnull(column_a), 1, column_a) as column_a_2

resident table_1

 

but here, instead of adding the new column to table_1, is creating a new table 'table_1-3' (no idea why its add a 3 instead of a 2, i guess) with all the columns on table_1, plus the addicional column and a synthetic key joining table_1 with table_1-3 on all the * columns.

 

Thanks for any help.

Labels (2)
1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

A Load statement will create a new table. The name "table_1-3" is being assigned because the name assigned in your label "table_1:" is already in use. 

You should create a table with a different name and DROP the original table_1.

table_1_new:
load
  *,
  if(isnull(column_a), 1, column_a) as column_a_2
resident table_1;

DROP Table table_1;

-Rob

View solution in original post

2 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

A Load statement will create a new table. The name "table_1-3" is being assigned because the name assigned in your label "table_1:" is already in use. 

You should create a table with a different name and DROP the original table_1.

table_1_new:
load
  *,
  if(isnull(column_a), 1, column_a) as column_a_2
resident table_1;

DROP Table table_1;

-Rob

Zorak
Contributor II
Contributor II
Author

Thank you, I had to rewrite the code before to keep the original name at the end, but it worked as I needed it.