• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » SQL Syntax error expected something between '(' and the 'left' keyword

#1 2011-11-23 01:58:05

talendtester
Member
Registered: 2009-07-15
Posts: 99

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: [Teradata Database] [TeraJDBC 13.00.00.16] [Error 3706] [SQLState 42000] Syntax error: expected something between '(' and the 'left' keyword.

Do I need to somehow escape the word "left" or "cast"?

Offline

#2 2011-11-23 10:06:22

janhess
Member
Company: Newcastle University
Registered: 2009-05-19
Posts: 1123

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

Have you got the SQL in quotes?

Offline

#3 2011-11-23 18:14:18

talendtester
Member
Registered: 2009-07-15
Posts: 99

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 "\\"?

Last edited by talendtester (2011-11-23 18:14:48)

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » SQL Syntax error expected something between '(' and the 'left' keyword

Board footer

Powered by FluxBB