Put custom value in sql query doesn't work

Five Stars

Put custom value in sql query doesn't work

Hi,

 

 

i try to use custom code in sql query in tDBROW to delete data but it's not working...

 

Here is my request in tDBRow :

 

"DELETE  FROM `pricelistdetailed` WHERE `MonthYear` = " +TalendDate.getDate("YYYY")+ "-"+ TalendDate.addDate(TalendDate.getDate("MM") , "MM", -1,"MM")

 

I got no error when i execute the job.

 

for testing i used a tMsgBox to display the custom value :

 

"Hello world!" + TalendDate.getDate("YYYY")+ "-"+ TalendDate.addDate(TalendDate.getDate("MM") , "MM", -1,"MM")

 

This work, it display : 2020-01

 

It's someting miising?

 

Thanks,

Pierrick

 

 

 

 

 

 

 

Tags (3)

Accepted Solutions
Highlighted
Five Stars

Re: Put custom value in sql query doesn't work

Hi,

 

i find the solution there is missing quote at the end of the line :

 

"DELETE  FROM `pricelistdetailed` WHERE `MonthYear` = ' " +TalendDate.getDate("YYYY")+ "-"+ TalendDate.addDate(TalendDate.getDate("MM") , "MM", -1,"MM") +" ' "

 

Regards

 

 

View solution in original post


All Replies
Highlighted
Five Stars

Re: Put custom value in sql query doesn't work

Hi,

 

i find the solution there is missing quote at the end of the line :

 

"DELETE  FROM `pricelistdetailed` WHERE `MonthYear` = ' " +TalendDate.getDate("YYYY")+ "-"+ TalendDate.addDate(TalendDate.getDate("MM") , "MM", -1,"MM") +" ' "

 

Regards

 

 

View solution in original post

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 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 3

Read about some useful Context Variable ideas

Blog