Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Adorable09
Contributor III
Contributor III

Date format issue when connecting to DB2 database

Hi All,

I am connecting to DB2 Server and applying a simple date filter in where condition as shown below

SQL SELECT *
FROM XYZ  where TDATE='22-08-2024';

or 

FROM XYZ  where TDATE='$(vDate)';     

TDATE is in 'DD-MM-YYYY' format in the database so is vDate variable.

But I get an error :

QVX_UNEXPECTED_END_OF_DATA: SQL##f - SqlState: 22007, ErrorCode: 4294967115, ErrorMsg: [IBM][CLI Driver][DB2/LINUXX8664] SQL0181N
The string representation of a datetime value is out of range. SQLSTATE=22007

This seems to be issue related to DB2.Can anyone please suggest?

Thanks.

QlikView 

 

Labels (2)
1 Solution

Accepted Solutions
Adorable09
Contributor III
Contributor III
Author

@hic Thanks it works .Looks like TDATE accepts YYYY-MM-DD OR M/DD/YYYY format.

View solution in original post

2 Replies
hic
Former Employee
Former Employee

Where-clauses with dates in databases can be tricky, depending on how the dates are stored. Often you need to use Cast() or some formatting function. Try

 WHERE VARCHAR_FORMAT (TDATE,'YYYY-MM-DD') = '2024-08-22' ; 

Adorable09
Contributor III
Contributor III
Author

@hic Thanks it works .Looks like TDATE accepts YYYY-MM-DD OR M/DD/YYYY format.