One Star

[resolved] Advanced Settings SQL Expression Syntax

Hi everyone,
Just a quick question: while typing in an SQL expression in the Advanced Settings/Additional Columns section of an SQL Output component, if I want to use the column I am referencing in the expression itself, how will I do it?
For example:
"CASE WHEN COL_1 LIKE '%ABC%' THEN SUBSTRING(COL_1, 12, 13) ELSE ' ' "
If I just type COL_1, Talend doesn't recognize the column. If I use 'COL_1', then Talend thinks it is just a bit of text.
Any ideas?
Thanks!
Cihan
1 ACCEPTED SOLUTION

Accepted Solutions
One Star

Re: [resolved] Advanced Settings SQL Expression Syntax

hi! try to use double quotes and concatenate the strings like this:
"CASE WHEN "+COL_1+" LIKE '%ABC%' THEN SUBSTRING("+COL_1+", 12, 13) ELSE ' ' "
4 REPLIES
One Star

Re: [resolved] Advanced Settings SQL Expression Syntax

Putting COL_1 in brackets also didn't work; Talend again couldn't recognize the column name.
Would be really glad if anyone had a solution/suggestion.
Thanks!
One Star

Re: [resolved] Advanced Settings SQL Expression Syntax




I tried using brackets around the column name, like . That also didn't work.
One Star

Re: [resolved] Advanced Settings SQL Expression Syntax

hi! try to use double quotes and concatenate the strings like this:
"CASE WHEN "+COL_1+" LIKE '%ABC%' THEN SUBSTRING("+COL_1+", 12, 13) ELSE ' ' "
One Star

Re: [resolved] Advanced Settings SQL Expression Syntax

OK, that should work. Thanks!