Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 output parameter

Author  Topic 

arusu
Yak Posting Veteran

60 Posts

Posted - 2010-12-13 : 18:03:32
I was just wondering how you would make one sql statement for 2 output parameters.

So you have
@param1 and @param2

and you would do a "select name, phone from customer where country = canada". Then put the name into @param1 and phone into @param2

also what if there was multiple results, how would that be handled in terms of using this stored procedure to output the results into another application made in c#, parse the results and store them in a list in this c# app

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-12-13 : 18:37:47
If there's only one row returned, then use this:
select @param1 = name, @param2 = phone
from ...

Otherwise, return the entire result set back to your application and do the parsing there.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

SQLMAKESMECRY
Starting Member

14 Posts

Posted - 2011-03-17 : 07:12:47
You will need three data sets.

data set 1 - main data
select *
from Main_data
where name = ? and phone = ?

data set 2
select name
from Main_data

data set 3
select phone
from Main_data

Then you create the two report params linking them dynamically to dataset 2 and 3.
Then go to your main data data set 1 and create 2 data set params to link to data set 2 and data set 3.

If you've already found your answer cool.. but maybe this post can help other BIRT Users.

Cricket

It's not fun unless I'm pulling my hair out. Weee!
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-03-17 : 07:57:42
^^ Wow, no wonder your name is SQLMAKESMECRY. This answer makes me want to cry.

arusu, Tara's answer is spot on for your question. Do post back if you have further questions on this.
Go to Top of Page

SQLMAKESMECRY
Starting Member

14 Posts

Posted - 2011-03-18 : 14:30:52
quote:
Originally posted by russell

^^ Wow, no wonder your name is SQLMAKESMECRY. This answer makes me want to cry.

arusu, Tara's answer is spot on for your question. Do post back if you have further questions on this.

I'm sorry, I was under the impression that Arusu was using BIRT from looking at Arusu's other posts. I am pretty familiar with parameter setup in BIRT and they, to me anyhow, can very tricky with some data. When I read Tara's answer trying to apply it to BIRT parameters, it made no sense whatsoever. I don't claim to be a sql goddess. But hey, thanks for attempting to inspire feelings of insecurity for others who may feel like they may have something to offer to those who may be less than the status of a sql Deity. I think it's great to be so knowledgeable in a subject but it's also nice to step outside your own circle of understanding.

Cricket

It's not fun unless I'm pulling my hair out. Weee!
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-03-20 : 22:02:12
I agree with you that more knowledge is always better than less. And I appreciate you taking the time to respond.

It scares me however, when potentially bad advice goes unchallenged. As is the case with your reply vs the original question. However, on a broader scale, your answer may be appropriate.

I certainly meant no offense.

Please do continue visiting and contributing.
Go to Top of Page

SQLMAKESMECRY
Starting Member

14 Posts

Posted - 2011-03-21 : 08:34:41
quote:
Originally posted by russell

I agree with you that more knowledge is always better than less. And I appreciate you taking the time to respond.

It scares me however, when potentially bad advice goes unchallenged. As is the case with your reply vs the original question. However, on a broader scale, your answer may be appropriate.

I certainly meant no offense.

Please do continue visiting and contributing.


I appreciate your response. Thank you,
Cricket.
Go to Top of Page
   

- Advertisement -