Discussion board where members can get started with QlikView.
is it possible to insert today() function into an sql select. For example:
sql select field1, field2, year from table1 where year < year(today());
I always get an error
Thanks for your help
try using GETDATE()
Try year(getdate()) instead.
Thanks very much. Is it right just for SQL SERVER or is it proper for ORACLE too ?
i'm using microsoft sql server. not sure if it is the correct syntax for oracle.
The GetDate() function is definitely the right answer in this case as suggested above.
However in some cases it may be needed to pass values from qlikview script to an sql statement.
Here's an example (something I've already used):
let vField1 = Peek('SystemField1',0,'RelatedTableFields');let vField2 = Peek('SystemField2',0,'RelatedTableFields');
PropertyValues:LOAD $(vField1), $(vField2);SQL SELECT DISTINCT $(vField1), $(vField2) FROM $(vTableName);
Hope this will prove useful in future situations
Hi, for Oracle, try this:
sql select field1, field2, year from table1 where year < to_char(sysdate,'YYYY');
I hope that helps you.