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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Count from a stored procedure execute...

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-03-16 : 09:14:45
Jeremy writes "I need to create a stored procedure in Version 8.00 which returns a Count from an Execute (with a passed variable) of a previously created stored procedure. Doing it through stored procedures is a requirement...if we can't do it through stored procs, then we can't use SQL for this task.

For example:

CREATE PROCEDURE [SP_PROC_B]
@FCN_RESULT TINYINT OUTPUT,
@VARNUMBER VARCHAR(7)
AS
BEGIN
EXEC dbo.SP_PROC_A @VARNUMBER
--What can I do around this execute to return a count
--set to @FCN_RESULT???
END
GO


If I:

EXEC SP_PROC_B @result, 'ABC1234'

with ABC1234 as my VarNumber, I need the count of those rows returned by the first stored proc (SP_PROC_A).

Hope that makes sense.
Thanks."

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-03-16 : 09:26:22
After

EXEC dbo.SP_PROC_A @VARNUMBER

Run

Select @FCN_RESULT=@@RowCount
Select @FCN_RESULT



Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -