Talend Connect
Virtual Summit
JOIN US!
And visit the Customer
& Community Lounge.
May 27-28, wherever you are.

SQL Syntax error expected something between '(' and the 'left' keyword

Highlighted
Nine Stars

SQL Syntax error expected something between '(' and the 'left' keyword

My data looks like:
yyyymmdd
20111122
The Teradata database SQL is converting the varchar to a date so it looks like:
2011-11-22
My SQL:
SELECT
cast(left( myDate, 4) || '-' ||
substr(myDate, 5,2) || '-' ||
substr(myDate,length(myDate) - 2 + 1, 2) as date )
as PULL_DATE
FROM myDatabase.myTable
How can I get this SQL to run successfully in a tTeradataInput component?
The SQL runs fine outside of Talend.
The error message:
Exception in component tTeradataInput_3
com.teradata.jdbc.jdbc_4.util.JDBCException: Syntax error: expected something between '(' and the 'left' keyword.
Do I need to somehow escape the word "left" or "cast"?
Highlighted
One Star

Re: SQL Syntax error expected something between '(' and the 'left' keyword

Have you got the SQL in quotes?
Highlighted
Nine Stars

Re: SQL Syntax error expected something between '(' and the 'left' keyword

I have double quotes before and after the SQL. In my SQL I have single quotes.
Do I need to escape the vertical bars individually with "\\"?

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

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