delete from SQL table based on global variable

One Star

delete from SQL table based on global variable

Hi
I am trying delete data from SQL server based on a date range that I am passing to the SQl statement using a global variable.
I am not where my statement is wrong, but it is giving me an error. (see screen shots)
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Syntax error on token "(", Expression expected after this token
at talenddemosjava.test_delete_data_from_sql_server1_0_1.Test_Delete_Data_From_SQL_Server1.tFileInputExcel_1Process(Test_Delete_Data_From_SQL_Server1.java:3406)
Please help
Four Stars

Re: delete from SQL table based on global variable

You need to distinguish what is SQL and what are Talend/Java variables. You're missing """ and "+"s in your where clause.
Should be: "select * from table where date1 >= " + globalVar1 + " and date2 <= " + globalVar2