Four Stars

Too much time on this problem (java.sql.SQLException: Conversion failed when converting date and/or time from character string)

 

I have a very persistent error that I have detailed in the attached PDF. Thanks so much for any help!

 

Allen

  • Data Integration
1 ACCEPTED SOLUTION

Accepted Solutions
Nine Stars TRF
Nine Stars

Re: Too much time on this problem (java.sql.SQLException: Conversion failed when converting date and/or time from character string)

You may convert the input dates as String then use the result for the comparison:

select convert(varchar(19), yourDateColumn, 120) AS date1

Also the inner join seems strange to me, but no time left to analyze in detail.

Should "SELECT ... ON xxxxxx WHERE date1 > '" + (String)globalMap.get("foo") + "'".

No?


TRF
2 REPLIES
Nine Stars TRF
Nine Stars

Re: Too much time on this problem (java.sql.SQLException: Conversion failed when converting date and/or time from character string)

You may convert the input dates as String then use the result for the comparison:

select convert(varchar(19), yourDateColumn, 120) AS date1

Also the inner join seems strange to me, but no time left to analyze in detail.

Should "SELECT ... ON xxxxxx WHERE date1 > '" + (String)globalMap.get("foo") + "'".

No?


TRF
Four Stars

Re: Too much time on this problem (java.sql.SQLException: Conversion failed when converting date and/or time from character string)

The solution kindly provided stopped errors, but the date format still was not bringing correct results. 

I finally had to keep the date as a date and not a string and use this to make it work correctly:

 AND  A.[DATE_ADDED] >  ' " + TalendDate.formatDate("yyyy-MM-dd hh:mm:ss", (Date)globalMap.get("maxDate"))  + " '

 

Thanks for your help