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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

truncating without insert/update

Hi,
A newbie question I am afraid!
how do i execute a truncate table(s) set of statements (mysql database ) at the start of a job . I do not want to load records at this point(so no using tmysqloutput).
I have tried to use tMysqlRow but recieve an error i assume means that this component cannot run DDL statements. I would like to dynamicly select which table to truncate based on runtime context so a stored proc is not going to work.
comments and assistance appreciated

regards
Neil

Labels (2)
6 Replies
TRF
Champion II
Champion II

Hi,
Have a look here thread.
Should also works with tMysqlRow (I suppose so).

Regards,
TRF
Anonymous
Not applicable
Author

I have tried this  . I dont think Mysql supports this syntax as i cant run it on a basic editor outside of talend.
vapukov
Master II
Master II

tMySQLRow with command - "truncate table your_table_name;"

or "TRUNCATE TABLE "+((String)globalMapGet("v_your_table_name")) for make it dynamic
You can run more than 1 command line in same component, but this depends from database and You may need read information for additional JDBC string parameters 

Redshift on picture - just examples, I use this and for MySQL and other types

0683p000009MGEy.png
Anonymous
Not applicable
Author

Thanks! 

Works fine now.

i added "allowMultiQueries=true" under additional JDBC paramers so i can run multiple statements.
Anonymous
Not applicable
Author

How do i now mark this as resolved?
Anonymous
Not applicable
Author

Hi,
You can click the "Set this topic as resolved" link which is right underneath your initial post? This way, other users will be informed that this thread has been resolved.
Best regards
Sabrina