Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Execute SQL file

Hello,

I have a file which contains my the SQL I need to be executed. How can I execute this query from my file in my Teradata Database? I tried to use the tJava component, but with no success, maybe because I don't know Java at all.

Can you help me with a solution?

Thank you in advance!
Lucian Sabau

Labels (2)
1 Solution

Accepted Solutions
JR1
Creator III
Creator III

Try to store the query from the input file in a global variable:

tFileInputRaw --row1 (main)--> tConvertType --row2 (main)--> tFlowToIterate --iterate--> (your Teradata query component here)

The tFileInputRaw component will give you one output field which will contain the whole content of the file. In the SQL statement in your Teradata component, put something like ((String)globalMap.get('row2.content')). The tConvertType component is just there to convert the data of type "Object" into a "String". I am not sure if it is really necessary.

View solution in original post

3 Replies
JR1
Creator III
Creator III

Try to store the query from the input file in a global variable:

tFileInputRaw --row1 (main)--> tConvertType --row2 (main)--> tFlowToIterate --iterate--> (your Teradata query component here)

The tFileInputRaw component will give you one output field which will contain the whole content of the file. In the SQL statement in your Teradata component, put something like ((String)globalMap.get('row2.content')). The tConvertType component is just there to convert the data of type "Object" into a "String". I am not sure if it is really necessary.
Anonymous
Not applicable
Author

thanks for your feedback. It's working great!
I used tFileInputRaw - TJavaRow (to redirect the input) - tFlowToIterate - tTeradataInput. In my last component it is enough to put  row1.qry (the input of tFlowToIterate component).

Have a great Day!
Lucian
Anonymous
Not applicable
Author

Hi Lucian,
Great your issue is fixed. Could you please mark this topic as resolved?
Best regards
Sabrina