Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Consuming the rows of a called SP inside another SP
Message
From
21/11/2006 11:02:08
James Blackburn
Qualty Design Systems, Inc.
Kuna, Idaho, United States
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01171249
Message ID:
01171452
Views:
6
David,

I don't use MsSql much but I would it this way in the Sybase database I use.
  declare @iRows int ;
  Select .... into #temptable from ... 
  set @iRows = @@rowcount
   -- @iWantCountOnly is  parameter to so only the rows are returned.
  if @iWantCountOnly = 1 then 
     select @iRows ;
  else 
     Select * from #temptable;
     select @iRows ; -- if you want both values
  end if ;
>
>-- SP_1
>select .... -- a really complex query
>return @@rowcount
>
>
>-- SP_1Count
>declare @iRows int
>execute @iRows = SP_1
>select @iRows as NumberOfItems
>
>
>When SP1_Count is called from anywhere (QueryAnalyzer, VFP, ADO) there are two recordsets returned. I'd really like to only have the select @iRows result come back to the client. So how can I get SP_1Count to swallow up the recordset produced by SP_1?
Previous
Reply
Map
View

Click here to load this message in the networking platform