Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

sql where statment using variable

I am have problem, when I use the variable

let vExecTime='2015-03-25' in a load sql select statment,

sql where statement (WHERE MODIFIED < '$(ThisExecTime)')

return 0 records from sql table while when replace variable with '2015-03-25'  sql select statmen works?

5 Replies
MVP
MVP

Re: sql where statment using variable

MODIFIED should be in YYYY-MM-DD format !

Also check < or > depending upon your requirements.

Highlighted
anbu1984
Honored Contributor III

Re: sql where statment using variable

Is it because you used wrong variable name in Sql??

(let vExecTime='2015-03-25' in a load sql select statment,)

sql where statement (WHERE MODIFIED < '$(ThisExecTime)')


Re: sql where statment using variable

Try sql where statement (WHERE MODIFIED < '$(vExecTime)')

Not applicable

Re: sql where statment using variable

anbu got it right! that was the fix;


I am trying to create a QVW that does incremental loads of large SQL tables that get updated daily. 


The scripting in Re: Re: Incremental Load Script

for case 4 worked fine until I added a second set of data (different SQL table) to save a 2nd QVD.  The script runs correctly for the 1st incremental load and creates an updated QVD then drops/ at end of second table right as it starts to store the 2nd QVD that has an incremental load with same scripting in case 2 (Load Insert/Update/Delete).

Not applicable

Re: sql where statment using variable

anbu got it right! that was the fix;


I am trying to create a QVW that does incremental loads of large SQL tables that get updated daily.


The scripting in Re: Re: Incremental Load Script

for case 4 worked fine until I added a second set of data (different SQL table) to save a 2nd QVD.  The script runs correctly for the 1st incremental load and creates an updated QVD then drops/ at end of second table right as it starts to store the 2nd QVD that has an incremental load with same scripting in case 4 (Load Insert/Update/Delete).  typo both are case 4 incremental loads.