Re: how to return a value in a stored procedure?
- From: "Andrew J. Kelly" <sqlmvpnooospam@xxxxxxxxxxxx>
- Date: Fri, 9 Nov 2007 19:40:07 -0500
You need to use an output parameter. Have a look at these:
http://msdn2.microsoft.com/en-us/library/ms971497.aspx
http://www.sommarskog.se/share_data.html
http://www.informit.com/articles/article.aspx?p=25288&seqNum=9&rl=1
--
Andrew J. Kelly SQL MVP
Solid Quality Mentors
"Chris" <ch@xxxxxxx> wrote in message news:%23TUm6byIIHA.5860@xxxxxxxxxxxxxxxxxxxxxxx
Hi,
i use a stored procedure for my asp.net application which must return a value: (number of items). How can i do that?
I tried this but don't know how to giive te found value back.
Thansk
Chris
ALTER PROCEDURE [dbo].[mysp]
AS
declare @returnValue int
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
select COUNT(DISTINCT numberofitems) from items
END
set @returnValue = ???
return @returnValue
.
- Follow-Ups:
- Re: how to return a value in a stored procedure?
- From: Chris
- Re: how to return a value in a stored procedure?
- References:
- how to return a value in a stored procedure?
- From: Chris
- how to return a value in a stored procedure?
- Prev by Date: how to return a value in a stored procedure?
- Next by Date: Re: how to return a value in a stored procedure?
- Previous by thread: how to return a value in a stored procedure?
- Next by thread: Re: how to return a value in a stored procedure?
- Index(es):
Relevant Pages
|