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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Albot248
Contributor II
Contributor II

Parameter index on tMSSqlRow prepared statement

Hi
I want to execute a SQL query with the tMSSqlRow component, as input I'm using a tXMLMap component. The SQL query should be executed for every incoming row, using two values (eid, communication_number; both of data type integer) as parameters.
In the basic settings of tMSSql I entered the SQL query with question marks as placeholders for the parameters:
"UPDATE  mytable
SET eid = ?
WHERE communication_number = ?"

Under advanced settings I activated "Use PreparedStatement" and I defined the two parameters with parameter indexes 1 and 2.
When I run the job, I got the error message "Invalid parameter index 1". Any ideas what could be the cause for that error?
Thanks
Tom
Labels (3)
1 Reply
Anonymous
Not applicable

Hi  
You need to iterate each input row using tFlowToIterate component, the job looks like
....tXMLMap--main(out1)--tFlowToIterte--iterate--tMssqlRow
on tMssqlRow, write the query as:
"Update mytable set eid="+(Integer)globalMap.get("out1.eid")+"where communication_number="+(Integer)globalMap.get("out1. communication_number")
BTW, why don't you use tMssqlOutput to update the data? For example:
....tXMLMap--main(out1)--tMssqlOutput
Set eid column as a key on the schema, and select 'update' item in the Action on data list.
Regards
Shong