Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

josephinetedesc
Contributor III

help with dates in SQL

Re: Help with Sql Where Date >

Hi All

I have looked at the discussion above but I need help to do the following:

Below is the current script to get the dates I am interested in - however what I want is not to hard code the ScheduledDate.  I would like to change  ScheduledDate < '2017-09-01'

and make it  ScheduledDate < today() + 30

Is this possible given that 'today() + 30' is is qlikview but it is part of an SQL select?

Thank you

Jo

aaa:

SQL SELECT *

FROM Cccc.dbo.[vwdr_ppDays]

  where ScheduledDate >= '2016-01-01' and ScheduledDate < '2017-09-01'

;

STORE

aaa INTO

[aaa.qvd] (qvd);

drop table aaa;

Tags (1)
1 Solution

Accepted Solutions
sasiparupudi1
Honored Contributor III

Re: help with dates in SQL

Try

Let vDate =Date(Floor(Today())+30,'YYYY-MM-DD');

5 Replies
MVP
MVP

Re: help with dates in SQL

May be this

aaa:

SQL SELECT *

FROM Cccc.dbo.[vwdr_ppDays]

  where ScheduledDate >= '2016-01-01' and ScheduledDate < (SYSDATE + 30);

sasiparupudi1
Honored Contributor III

Re: help with dates in SQL

Let vDate ='Date (Floor (Today ())+30),''YYYY-MM-DD'')'

In the sql where condition,

ScheduledDate<'$(vDate)'


hth

Sasi

josephinetedesc
Contributor III

Re: help with dates in SQL

Let vDate ='Date(Floor(Today())+30),''YYYY-MM-DD'')';

on using debug this s gives vDate as :"Date(Floor(Today())+30),'YYYY-MM-DD')"

and causes a problem when trying to use it.

Let vDate =Date(Floor(Today())+30);  this gives the vDate as 7/09/2017 but then the problem is that it is in the wrong format.

Jo

sasiparupudi1
Honored Contributor III

Re: help with dates in SQL

Try

Let vDate =Date(Floor(Today())+30,'YYYY-MM-DD');

josephinetedesc
Contributor III

Re: help with dates in SQL

Thank you that worked!  Where could I have found information about how to worked with dates as text???