Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
karan_kn
Creator II
Creator II

Load only field contains ID

I need to load only field contains ID. How can I do this in the load script. 

Where Clause would work but could take a longer time to load. It would be great if you suggest other options.

where clause in SQL statement

Capture.JPG

T1:

LOAD Distinct

ID,

Key,

Parameter;

SQL SELECT *

FROM "Server"."Prod".table1;

1 Solution

Accepted Solutions
Frank_Hartmann
Master II
Master II

You can use Resident Load:

T1:

LOAD Distinct

ID,

Key,

Parameter;

SQL SELECT *

FROM "Server"."Prod".table1;

T2:

Load

If(len(ID)>0,ID,Null())as ID,

If(len(ID)>0,Key,Null())as Key,

If(len(ID)>0,Parameter,Null())as Parameter

Resident T1; DROP Table T1;

View solution in original post

4 Replies
Frank_Hartmann
Master II
Master II

maybe like that:

tmp0:

LOAD * INLINE [

    Field1, Field2, Field3

    213, sd, hj

    436, ggrer, uzt

    5467, sdf, uzk

    76, ght, fr

    687, dd, rr

    , trh, jzt

    , rzt, ziu

    , , olöoi

];

NoConcatenate

tmp1:

Load If(len(Field1)>0,Field1,Null()) as Field1,

If(len(Field1)>0,Field2,Null()) as Field2,

If(len(Field1)>0,Field3,Null()) as Field3

Resident tmp0; DROP Table tmp0;

karan_kn
Creator II
Creator II
Author

Thanks for the response, can you help me within the sql load statement?

Frank_Hartmann
Master II
Master II

You can use Resident Load:

T1:

LOAD Distinct

ID,

Key,

Parameter;

SQL SELECT *

FROM "Server"."Prod".table1;

T2:

Load

If(len(ID)>0,ID,Null())as ID,

If(len(ID)>0,Key,Null())as Key,

If(len(ID)>0,Parameter,Null())as Parameter

Resident T1; DROP Table T1;

karan_kn
Creator II
Creator II
Author

Thanks Frank