Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 
0 Kudos

1. Problem

IQ failed to execute a select query with cast function via dbisql/dbiqlc.

But It's working well via isql.

-> select CAST ('04/09/2015' AS datetime) AS Converted_Date from iq_dummy;


    Cannot convert '04/09/2015' to a timestamp

    SQLCODE=-157, ODBC 3 State="07006"

2. Cause

As far as you know the isql is oriented for ASE not IQ.

So The default value of "date order" is different from IQ.

The default order of date is 'YMD' in IQ.

** Test in IQ vs ASE

- create table a_tab(col1 datetime)

- insert into a_tab values(getdate())

- select * from a_tab

1) [ASE]



Apr 9 2015 8:30AM

2) [IQ]


'2015-04-09 08:54:13.155'

## Related Option


: Controls the interpretation of date formats.


  'YMD'. This corresponds to ISO date format specifications.

3. Solutions/Workarounds

Need to change the query with date_order option as follows.

- set temporary option date_order='MDY';
- select CAST ('04/09/2015' AS datetime) AS Converted_Date from iq_dummy;



Gi-Sung Jang