Error in updating Row in tDB2Row

Seven Stars

Error in updating Row in tDB2Row

Query : ScreenShot 1

"Update "
+context.DBTableName
+" SET status = 1,processed_time="
+TalendDate.getCurrentDate()
+", last_modified_on="+TalendDate.getCurrentDate()
+" where file_name="+context.Transfer

 

 

ScreenShot 1ScreenShot 1

Error : ScreenShot 2

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'May 29 13:41:09 IST 2018, last_modified_on=Tue May 29 13:41:09 IST 2018 where fi' at line 1ScreenShot2ScreenShot2

 

 

Highlighted
Moderator

Re: Error in updating Row in tDB2Row

@meetmahajan,can you try with below one?

 

"Update "
+context.DBTableName
+" SET status = 1,processed_time="
+"'"+TalendDate.getCurrentDate()+"'"
+", last_modified_on="+"'"+TalendDate.getCurrentDate()+"'"
+" where file_name="+"'"+context.Transfer+"' "

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Highlighted
Seven Stars

Re: Error in updating Row in tDB2Row

@manodwhb

I Tried but getting Data Truncation Error 

Error

Data truncation: Incorrect datetime value: 'Tue May 29 16:42:20 IST 2018' for column 'processed_time' at row 1

Highlighted
Moderator

Re: Error in updating Row in tDB2Row

@meetmahajan, you need to convert the date to required format for processed_time.

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Highlighted
Seven Stars

Re: Error in updating Row in tDB2Row

i have converted datatype into DATE  and in data base it is also the same still i'm getting an error 

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog