Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Community,
I get an issue when I use the component tDBInput. I would like to use the context variable in SQL but it's not working.
I need to replace in the SQL the syntax in the clause FROM like :
"
SELECT
*
FROM
"NAV2K9R2-PROD".dbo."CK sa$Purch_ Inv_ Header"
I read on another post to use simple quote but I do not understand how it's work. I still have an error when I write like this :
SELECT
*
FROM
'
"
+
context.dbWorkflow_Database
+
"
.
"
+
context.dbNavision1_Schema
+
"
.
"
+
context.vPurchInvoice
"
'
How is it work in SQL to use context because I have the error 'Invalid object name' or '+' invalid syntax. ?
Thanks a lot,
Romain.
Hello,
When you're running your job with log4j debug logs it will print the actual query submitted to the database. From that you could see how the parameters work. There's no variable substitution in talend. The queries are java Strings. So instead of:
"SELECT * FROM [TABLE]" you can use: "SELECT * FROM [" + context.table + "]"
And this will generate the right query.
Thank for you reply.
But I have still the error 'Incorrect syntax near '+'' (below attachment ) It seems the SQL doesn't work with double quote or the brackets are not working ?