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)
 Record count of a sp

Author  Topic 

kensai
Posting Yak Master

172 Posts

Posted - 2002-02-26 : 17:52:40
I have a sp which returns some records as result. How can I find how many records it will return?

Lou
Yak Posting Veteran

59 Posts

Posted - 2002-02-26 : 17:57:15
Within the Sp:
select @row=count(*)
from
(
...
) as a
return @row

Execute the sp:
exec @row=mySp

I hope I answered your question.

Go to Top of Page

byrmol
Shed Building SQL Farmer

1591 Posts

Posted - 2002-02-26 : 18:01:31
Kensai,

Only gives the count of the last action in the Proc...


exec upSomeProc
Select @@RowCount


DavidM

Tomorrow is the same day as Today was the day before.
Go to Top of Page

kensai
Posting Yak Master

172 Posts

Posted - 2002-02-28 : 14:21:25
byrmol @@rowcount seems the way but I couldn't find the way to implement it to my code. my sp has some dynamic sql in it. like this:

set @sql='select bla bla..'

exec dbo.sp_executesql @sql

I returns the recordset like this. And I use GetRows in the ASP page to use it. I know I can use Command in ASP page and Return() in sp but I want to use GetRows. Do you have any idea to add @@rowcount to this sp?

Go to Top of Page

byrmol
Shed Building SQL Farmer

1591 Posts

Posted - 2002-02-28 : 17:06:50
kensai,

Why not use a ADO Command object?

Get the RETURN value.
Get the recordset from it, execute GetRows



DavidM

Tomorrow is the same day as Today was the day before.
Go to Top of Page
   

- Advertisement -