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
 Transact-SQL (2000)
 Simple Sproc Question re Parameter assignment

Author  Topic 

mobUL
Starting Member

2 Posts

Posted - 2004-07-09 : 10:23:08
I have a really simple problem but I am unable to see the solution
I have a Stored procedure (GetExamResults) that calls another Sproc (GetTests), thing is I need to store the number of records returned by the GetTests sproc in the variable @RecountCount.
When I run the GetExamResults I get

1
Test
0


why isn't @RecordCount equal to 1


CREATE PROCEDURE [dbo].[GetExamResults]
@ApplicantID int,
@RecordCount int OUTPUT
AS
--Run the Sproc
Exec GetTests @ID = @ApplicantID
Set @RecordCount = (@@RowCount)

Print @@RowCount
Print 'Test'
Print @QualCount
GO

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2004-07-09 : 10:30:36
@@RowCount is Zero after the execution of a sp.

If you want the rowcount of the result set of the sp you must return it in an output parameter from the sp

Duane.
Go to Top of Page

mobUL
Starting Member

2 Posts

Posted - 2004-07-09 : 10:35:16
Many thanks
Go to Top of Page
   

- Advertisement -