Read multiple dataset (output) of a sql server procedure

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
atul9806
Participant
Posts: 96
Joined: Tue Mar 06, 2012 6:12 am
Location: Pune
Contact:

Read multiple dataset (output) of a sql server procedure

Post by atul9806 »

Hi Team

I never worked on SQL server :| and current requirement is using a SQL server Procedure to fetch the data from DB and generate 3 output (with different metadata called dataset, this is same as if we run the 3 sql one after another). My requirement is to read all the output and do some manipulation.

Here, I am facing the problem, as Procedure will generate 3 outputs and I have to read all of them in one go, Can anyone help me how should I proceed?

Below are the solutions which I can think of -
1. Modify the SQL Procedure such a way that it will produce one output at a time
2. Modify the same to store the data into some temp table which datastage can use
Both solutions need to modify the procedure which I afraid is not allowed :(

I have very thin knowledge about SQL server so excuse me if I am asking very silly question.

Appreciate your comments and help.
~Atul Singh
<a href=http://www.datagenx.net>DataGenX</a> | <a href=https://www.linkedin.com/in/atulsinghds>LinkedIn</a>
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I'm a little lost here. You have a stored procedure that somehow 'generates' three output datasets at once? Or is this 'one after the other'? And then exactly what do you need to do with this? Other than read in one go and do some manipulation, I mean. You have three different targets that you'll need to hit, one after the other, whenever their dataset arrives in the output? :? Yikes.

In your shoes, my first question would be why do I need to use this stored procedure? What is it doing that I couldn't do in the ETL tool directly? Just because someone built it that doesn't necessarily mean I have to use the dang thing.
-craig

"You can never have too many knives" -- Logan Nine Fingers
atul9806
Participant
Posts: 96
Joined: Tue Mar 06, 2012 6:12 am
Location: Pune
Contact:

Post by atul9806 »

I agree with you craig but Client (you know them very well :)) is forcing to use that procedure to fetching the data. We have told them that can be coded in datastage also but he is not willing to use DS for fetching data. He want to RE-USE this procedure to fetch the data and apply other transformation in datastage.

Procedure is generated the output one after another with different metadata. AFAIK, we can not handle this kind of scenario in datastage. Please suggest If we can or manage procedure output somehow.

this will be something like this -

Calling Procedure --> 3 output (3 diff metadata) --here we have to read this data and manipulate it as per design.
As of now, we can think of to store these output to 3 target and then read from those tables and do the manipulations (which is again not a good design)

We are still trying to work with him to move totally on datastage. fingers crossed :)
~Atul Singh
<a href=http://www.datagenx.net>DataGenX</a> | <a href=https://www.linkedin.com/in/atulsinghds>LinkedIn</a>
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Are the three outputs delivered through three procedure arguments, or via its return value?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
atul9806
Participant
Posts: 96
Joined: Tue Mar 06, 2012 6:12 am
Location: Pune
Contact:

Post by atul9806 »

Output data is delivered through its return value.
~Atul Singh
<a href=http://www.datagenx.net>DataGenX</a> | <a href=https://www.linkedin.com/in/atulsinghds>LinkedIn</a>
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

Hi,

You will have three options in stored procedure stage, source ,target and transform.

If you don't have any input to stored procedure, then use it as a source and you will have option of return code and error code on the output link I believe , and based on this you can do the transformation.

Please let me know if it helps you.
Post Reply