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: 
sergio0592
Specialist III
Specialist III

Issue with use variable in SQL statement

Hi all,

I'am looking for use in my loading SQL statement, a date stored in a variable.

I have in my script sheet :

1.SQL which fetch DT_MAX

Select

to_char(max(DH_START),'DD/MM/YYYY') as DT_MAX
from MY_TABLE;

2.Assignment of DT_MAX in a variable

SET V_DT_END=DT_MAX;

3.Use of V_DT_END in my SQL statement

Select xxx

from xxx

where DT between '01/01/2016' and $(V_DT_END)

The third step don't works. If i write  between '01/01/2016' and '14/07/2017', it works. The problem is '. How to reproduce 'DT' with V_DT_END??

I have tried différents ways but the issue remains.

Thanks

11 Replies
antoniotiman
Master III
Master III

No Jean, because Peek('DT_MAX') -> is required from Peek() function

and '$(V_DT_END)' needs according SQL syntax.

Regards,

Antonio

vishsaggi
Champion III
Champion III

When you use this variable in a textbox what value can you see?