
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 :
but also
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 :
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 !
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Muller try below
LET v_Reference= '20140101';
SQL Select
BDD.DATEFIELD
FROM
BDD
WHERE
BDD.DATEFIELD >= $(v_Reference);
Regards
ASHFAQ

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
SQL Select
BDD.DATEFIELD
FROM
BDD
WHERE
BDD.DATEFIELD >= to_date('20140101','YYYYMMDD')

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Muller try below
LET v_Reference= '20140101';
SQL Select
BDD.DATEFIELD
FROM
BDD
WHERE
BDD.DATEFIELD >= $(v_Reference);
Regards
ASHFAQ

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your response,
Unfortunately, I get the same error "SQL0401: The operands of the comparison operator> = are not compatible."

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much Mohammed, it works !
