Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

SQL SELECT date from DB2

I do not understand why this isn't working.  I am trying to use SQL Select to read in a date field from a DB2 database.  The data is formatted as M/D/YYYY.  If I run this statement it pulls in everything.

SQL SELECT prd_dt

FROM table_A

But if I try to specify a date, it returns nothing:

SQL SELECT prd_dt

FROM table_A

WHERE date(prd_dt, 'M/D/YYYY') = '5/1/2016'

What am I missing here?  Thanks.

1 Solution

Accepted Solutions
boorgura
Specialist
Specialist

You cannot use Qlikview's Date function in the SQL statement - you will have to use DB2 syntax

for example

SQL SELECT ....

....

...

WHERE prd_dt = '2016-01-05'

(assuming that's your DB date format)

View solution in original post

3 Replies
boorgura
Specialist
Specialist

You cannot use Qlikview's Date function in the SQL statement - you will have to use DB2 syntax

for example

SQL SELECT ....

....

...

WHERE prd_dt = '2016-01-05'

(assuming that's your DB date format)

Anonymous
Not applicable
Author

In my case the correct format was

prd_dt = '2016-05-01'

Thank you for your help!!   

boorgura
Specialist
Specialist

My pleasure! Happy to help.