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...

Calling Talend Open Studio Users

The first 100 community members completing the Open Studio survey win a $10 gift voucher.

Start the survey

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download