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)
 using count in a stored procedure

Author  Topic 

PeterG
Posting Yak Master

156 Posts

Posted - 2002-04-08 : 12:13:47
I have these 2 table structures:

ProjectFolders
- FolderID
- FolderName

ProjectFiles
- FolderID
- DocName

I have this stored procedure:
"CREATE PROCEDURE SelectTreeMenu

AS

Declare @foldercount int

Select a.FolderName, b.DocName from ProjectFolders a
inner join ProjectFiles b on a.FolderID = b.FolderID

Select @foldercount = count(*) from ProjectFolders
where folderid <> 1

return @foldercount"

With my stored procedure, I want to return the folder and file names as a recordset and grab the folder count using comm.parameter(0).value in my asp page. When I run my asp page, I only get the recordset but not the folder count.

I'm thinking that perhaps I don't get a folder count because I don't pass any parameter to the stored procedure.

How can I get what I want? Pls help. Thanks.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-04-08 : 12:20:33
Take a look at this article:

http://www.sqlteam.com/item.asp?ItemID=2644

It has a really good overview on return values, OUTPUT parameters, and recordsets. It shows a way for you to call your procedure and have it get the value you want.

Go to Top of Page
   

- Advertisement -