Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem with date (AS400)

Hello everyone,

I am writing to you because I can't filter my data according to a date field.

I get data from an AS400 database, where I have raw data like :

date1.png but also date2.png

To convert this date, I use in my load :

    Date(date#(DATEFIELD,'YYYYMMDD'),'DD/MM/YYYY') as [Invoice Date],

With this, I can obtain an Invoice Date field look like :

date3.png

But, my problem is that I have to get data for an Invoice Date only superior to "01/01/2014".

So, in my script I tried to use :

SQL Select

     BDD.DATEFIELD

FROM

     BDD

WHERE

     BDD.DATEFIELD >= to_date('01/01/2014','DD/MM/YYYY')

But I obtain an error.

Or when I use BDD.DATEFIELD >= '20140101', it doesn't have any effect.

Is someone can help me ?

Thanks lot !

1 Solution

Accepted Solutions
ashfaq_haseeb
Champion III
Champion III

Hi Muller try below

LET v_Reference= '20140101';

SQL Select

     BDD.DATEFIELD

FROM

     BDD

WHERE

     BDD.DATEFIELD >= $(v_Reference);


Regards

ASHFAQ

View solution in original post

4 Replies
MK_QSL
MVP
MVP

SQL Select

     BDD.DATEFIELD

FROM

     BDD

WHERE

     BDD.DATEFIELD >= to_date('20140101','YYYYMMDD')

ashfaq_haseeb
Champion III
Champion III

Hi Muller try below

LET v_Reference= '20140101';

SQL Select

     BDD.DATEFIELD

FROM

     BDD

WHERE

     BDD.DATEFIELD >= $(v_Reference);


Regards

ASHFAQ

Not applicable
Author

Thanks for your response,

Unfortunately, I get the same error "SQL0401: The operands of the comparison operator> = are not compatible."

Not applicable
Author

Thank you very much Mohammed, it works !