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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Insert Data Using tmysqlrow

My scenario is: XXXXX -> tmap -> tmysqlrow. The output of tmap is row1(Main) which has two columns column1 and column2, now I want to insert column1 and column 2 as well as the curdate() into table1 in my database. How can I achieve it?


insert into table1(column1, column 2, date) values(select column1, column 2 from '"+row1.????+"', curdate());


What should I change? Thanks!

Labels (2)
4 Replies
cterenzi
Specialist
Specialist

There doesn't seem to be a reason to use tMysqlRow component here.  You can create a global variable containing a datestamp at the start of your job using a tSetGlobalVar with value: TalendDate.getDate("yyyy-MM-dd")
Add a column containing your datestamp to your flow with your tMap and insert with tMysqlOutput.
Anonymous
Not applicable
Author

cterenzi wrote:
There doesn't seem to be a reason to use tMysqlRow component here.  You can create a global variable containing a datestamp at the start of your job using a tSetGlobalVar with value: TalendDate.getDate("yyyy-MM-dd")
Add a column containing your datestamp to your flow with your tMap and insert with tMysqlOutput.

Thanks for your reply. DateStamp will be fine if go with what you said. But for the column1 & column2, I can't find proper way to call those two roles in the insert query since they are not in any tables. Thanks!!!
vapukov
Master II
Master II

You don't need GlobalVariable for date, You can use direct TalendDate.getDate("yyyy-MM-dd") in tMySQLRow
but in any case - SQL is wrong, it will not work and direct in database
cterenzi
Specialist
Specialist

If you use tMysqlOutput instead, you don't need to write the SQL. Just map the incoming schema to the schema of your table.