assign tMSSqlRow value to context variable?

Five Stars

assign tMSSqlRow value to context variable?

Hi,

 

 

how to assign tMSSqlRow value to context variable ?

 

Below is my query is written in tMSSqlRow_2. Need to read the value from tMSSqlRow_2 and assign to context variable. how to achieve this?  Please help

 

Query :

"
begin
declare
@srcid int,
@sessionid int;

select @srcid=srcid from dbo.src_tbl where src_name='xxx';

select sessionid from session_tbl where srcid=@srcid and loaddate='2011-12-20'
end
"

 

 

Additional info:

session_tble structure:
sessionid int IDENTITY(-3333333,1) not null ,
srcid int,
loaddate date

 

src_tbl structure:

src_id int,
src_name varchar(500)

 

Context:

Name          Type    Value (default)

SessionID    Int        -9999999

 

i have followed this :

tMSSqlConnection -->tMSSqlRow_1  --OnComponentOK---> tMSSqlRow_2  ---main--->tJavaRow-->tLogRow 

 

i have written above code in tMSSqlRow_2, in tMSSqlRow_1  ("sessionid")  is getting populated.

 

When i run job it is writtening null.

 

Please help.

 

 

Thanks

Fifteen Stars TRF
Fifteen Stars

Re: assign tMSSqlRow value to context variable?

Hi,
What's in tJavaRow?

TRF
Community Manager

Re: assign tMSSqlRow value to context variable?

Can I ask why you are using the tMSSqlRow for this? From what I have seen of your problem, it would be a lot more straight forward to use the tMSSqlInput to read the data and the tMSSqlOutput to write the data.

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Definitive Guide to Data Quality

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

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads