Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Not applicable

Today() into sql select

Dear all,

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

Gr.

6 Replies
Not applicable

Re: Today() into sql select

try using GETDATE()

mphekin12
Valued Contributor

Re: Today() into sql select

Try year(getdate()) instead.

Not applicable

Re: Today() into sql select

Thanks very much. Is it right just for SQL SERVER or is it proper for ORACLE too ?

Gr.

mphekin12
Valued Contributor

Re: Today() into sql select

i'm using microsoft sql server.  not sure if it is the correct syntax for oracle.

Not applicable

Re: Today() into sql select

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

Not applicable

Re: Today() into sql select

Hi, for Oracle, try this:

sql select field1, field2, year from table1 where  year < to_char(sysdate,'YYYY');

I hope that helps you.

Regards.

Zak

Community Browser