how to get the count of the rows affected by the query ..

One Star

how to get the count of the rows affected by the query ..

hi all,
how to get the COUNT of the rows affected by the query written in tmssqlrow,
my job is reading the table name from csv-- and the query is
"UPDATE "+row3.Table_Name+
" SET "+ row3.Table_Name+"."+"Error_Code = 'REJECTED' WHERE " + row3.Table_Name+"."+"gender='MALE'"
that means-- tinputfiledelimited--->tmssqlrow--->
now, i want to get the count of HOW many rows in my sql database have been affected by this query and display it in tlogrow.

thanks in advance,
Moderator

Re: how to get the count of the rows affected by the query ..

Hi,
The Nb_LINE is used to count the total number of records have been proceed.
The workflow should be that means-- tinputfiledelimited--->tmssqlrow--->tmssqloutput-->tjava.
When updated item is chosen, there will be a global variable such as ((Integer)globalMap.get("tmssqloutput_1_NB_LINE_UPDATED")) will be available, which counts the total number of records have been updated into database.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: how to get the count of the rows affected by the query ..

hi,
yes- for this to happen, the "tmssqlrow--->tmssqloutput" should have same schema. and the process of updating should be done by tmssqloutput.
but in my case, the updation is being done by the query which i have written in tmssqlrow!. and the schema which is being passed varies from the one which is actualy in the table.
Seven Stars

Re: how to get the count of the rows affected by the query ..

How can the Talend job be expected to know what the effect of a generic SQL update statement is on the DB when it is not providing the rows to be updated? If there is a command for SQL Server that you can call to get the effect of the last statement then you can call that with tMsSqlRow...