Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sql "LIKE" Issue in a Sql select Load Statement In Qlik Sense?

Hello,

I am trying to load columns from our database to Qlik sense. Some of the columns will be derived columns.

For eg : In my sql statement if I have something similar to this

Query: CASE WHEN Status LIKE 'Rejected*' THEN 'Rejected' ELSE 'Accepted' END AS CurrentStatus

Output: This column will show "Rejected" for every line regardless of the Status  .

If I change my query to

Query: CASE WHEN Status = 'Rejected' THEN 'Rejected' ELSE 'Accepted' END AS CurrentStatus

Output: It derives the right value for each line.

I have tried using IF Statement instead of CASE and that also doesnt seem to work.

Is there anything that I am missing? Any help/guidance would be appreciated!

Thanks!!!

1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

This is SQL syntax, so it is not evaluated by Qlik Sense. Instead it is evaluated by the ODBC driver / OLEDB provider. So, what's possible or not depends on which ODBC driver you use...

A work-around is to use a preceding Load:

Load *, If(Status='Rejected', Status, 'Accepted') as Status2;

SQL SELECT ... FROM ... ;

Then the Load is evaluated by Qlik Sense.

HIC

View solution in original post

2 Replies
hic
Former Employee
Former Employee

This is SQL syntax, so it is not evaluated by Qlik Sense. Instead it is evaluated by the ODBC driver / OLEDB provider. So, what's possible or not depends on which ODBC driver you use...

A work-around is to use a preceding Load:

Load *, If(Status='Rejected', Status, 'Accepted') as Status2;

SQL SELECT ... FROM ... ;

Then the Load is evaluated by Qlik Sense.

HIC

Not applicable
Author

Hi Henric,

Thanks for the response...

Turns out all I had to do was change the wildcard from '*' to '%' and it worked fine.

I understand now that '%' works for sql select statements and if you need to use a wildcard from a csv file, you need to use '*'.

Thanks again so much for taking the time to look into this.

Regards