Author |
Topic |
madhan
Yak Posting Veteran
59 Posts |
Posted - 2014-09-25 : 15:25:36
|
[code]ALTER PROCEDURE [dbo].[getFavoriteList] @customer_id int, @manufacturer_name varchar(200) OUTPUT as begin SET NOCOUNT ON select @manufacturer_name= manufacturer_name from dbo.Favorite_listreturnend[/code]Executing this procedure asdeclare @catname varchar(200);execute getFavoriteList 87381, @manufacturer_name= @catname OUT;select @catnameIt returns only one manufacturer name. in the table I have 4 names that all needs to be returned,please help |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-09-25 : 15:29:44
|
ALTER PROCEDURE [dbo].[getFavoriteList] as begin SET NOCOUNT ON select manufacturer_name from dbo.Favorite_listreturnendTara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
madhan
Yak Posting Veteran
59 Posts |
Posted - 2014-09-25 : 15:39:21
|
Thanks for the reply. But I want all the manufacturer names in a variable and that needs to be returned to be used in C# code. Is it possibe? |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-09-25 : 15:42:53
|
A variable can only contain one value. There is no reason to use a variable here. Just return the result set and have C# process the record set that's returned.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2014-09-25 : 15:43:50
|
Yes, if you tell us in what format you want multiple manufacturers to be presented. Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA |
|
|
madhan
Yak Posting Veteran
59 Posts |
Posted - 2014-09-25 : 16:05:03
|
quote: Originally posted by SwePeso Yes, if you tell us in what format you want multiple manufacturers to be presented. Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
I am not sure because I am new to returning data from Stored procedures. Could you please direct me with some variable that needs to saved with all manufacturer names? |
|
|
madhan
Yak Posting Veteran
59 Posts |
Posted - 2014-09-25 : 16:40:54
|
I want the output parameter specified in Stored procedure. Is it possible to return multiple manufacturer names in output parameter.@manufacturer_name varchar(200) OUTPUT |
|
|
madhan
Yak Posting Veteran
59 Posts |
Posted - 2014-09-25 : 16:46:43
|
quote: Originally posted by madhan I want the output parameter specified in Stored procedure. Is it possible to return multiple manufacturer names in output parameter.@manufacturer_name varchar(200) OUTPUTWhen I run the below t-sql the format that gave result is what I want as output valueselect manufacturer_name from dbo.Favorite_list
|
|
|
|