Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

sql select with parameter

Dear all,

I've the following sql select:

select FIELD1, FIELD2, FIELD3 from MYTABLE where project_id in ('AAA', 'BBB', 'CCC')

I would change it this way

SELECT FIELD1, FIELD2, FIELD3 from MYTABLE where poject_id in ('$(var_paramters)')

but I don't know the right way to build var_parameters

Help please

Thanks in advance

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Israr

I do not agree with reply above.

I routinely use SQL which exploits adding in text to the SQL command using QlikView variables as Krishna suggests, especially for incremental loads.

Have a look at the load script in the qvw attached to this document Incremental_Load.qvw



Best Regards,     Bill

View solution in original post

4 Replies
nagaiank
Specialist III
Specialist III

Try the following:

Set var_parameters = 'AAA', 'BBB', 'CCC';

SELECT FIELD1, FIELD2, FIELD3 from MYTABLE where poject_id in ($(var_paramters));

israrkhan
Specialist II
Specialist II

($(var_paramters)) ITS A QLIKVIEW syntax, You cant use it in select statement.

first load all record from sql like the script below:


SELECT FIELD1, FIELD2, FIELD3 from MYTABLE;

the do the preceding load of qlikview like below:


Set var_parameters = 'AAA', 'BBB', 'CCC';

SELECT FIELD1, FIELD2, FIELD3 from MYTABLE where poject_id in ($(var_paramters));


final script will look like below:


....................

Set var_parameters = 'AAA', 'BBB', 'CCC';


Load FIELD1, FIELD2, FIELD3  where poject_id in ($(var_paramters));


SQL SELECT FIELD1, FIELD2, FIELD3 from MYTABLE;

Anonymous
Not applicable
Author

Israr

I do not agree with reply above.

I routinely use SQL which exploits adding in text to the SQL command using QlikView variables as Krishna suggests, especially for incremental loads.

Have a look at the load script in the qvw attached to this document Incremental_Load.qvw



Best Regards,     Bill

Anonymous
Not applicable
Author

Thanks!!