calling a stored procedure in a while loop



I am trying to call a stored procedure in a while loop but for some
reason it only returns 1 row whereas I am expectint 12 rows
Here is the stored procedure and the call

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

ALTER procedure [dbo].[SP_FETCH_ROWS](@num int)
AS

SELECT Table_Name from TestData6061.INFORMATION_SCHEMA.Tables a where
@num =(select count(*) from TestData6061.INFORMATION_SCHEMA.Tables b
where a.Table_Name >= b.Table_Name)
go

While Loop which calls the stored procedure and passing the loop
counter as the argument
DECLARE @Count int DECLARE @MaxCount int
SET @Count = 0
SET @MaxCount = 29 WHILE @Count < @MaxCount BEGIN
SET @Count = @Count + 1 IF @Count = 1 OR
@Count = 4 OR
@Count = 7 OR
@Count = 8 OR
@Count = 14 OR
@Count = 17 OR
@Count = 18 OR
@Count = 22 OR
@Count = 25 OR
@Count = 27 OR
@Count = 28 OR
@Count = 29 EXEC releases.dbo.SP_FETCH_ROWS
@Count END

what am I missing here? I tried to figure out n looked for all kinds
of online documentation but still couldn't find the solution. please
helop
.



Relevant Pages

  • Re: Case statement issue
    ... except with a cursor other than the default ... > I have taken the sample of paging using a stored procedure from the ... > case statement, then the error message. ... > The for loop also seems to be a problem. ...
    (microsoft.public.inetserver.asp.general)
  • Re: Case statement issue
    ... except with a cursor other than the default ... > I have taken the sample of paging using a stored procedure from the ... > case statement, then the error message. ... > The for loop also seems to be a problem. ...
    (microsoft.public.inetserver.asp.general)
  • Case statement issue
    ... Windows enterprise 2003 OS with IIS version 6 on the server. ... I have taken the sample of paging using a stored procedure from the website ... case statement, then the error message. ... The for loop also seems to be a problem. ...
    (microsoft.public.inetserver.asp.general)
  • Re: vbscript logon script getting return data from sql sp
    ... Loop ... > One way to retrieve values from a stored procedure is with a Recordset ...
    (microsoft.public.scripting.vbscript)
  • Re: How to consume multiple result sets?
    ... Simply call NextResultin a loop until you go through all the ... "Carl San" wrote in message ... > In a stored procedure I have multiple output parameters and multiple ... > parameters and no rows were returned from stored procedure. ...
    (microsoft.public.dotnet.framework.adonet)