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)
 Stored Procedure only updates 10 rows

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-10-16 : 18:48:09
James writes "We are using a Stored Procedure to update statistics for football teams. It runs fine for the first 10 or so players and then just seems to quit. If I run it from SQL Server Query Analyzer, it runs all the way through. But if I call it from my ASP script it only does about 10-12 of the players. Any suggestions?
Below is an example of what we are doing (all the variables have been declared, I just didn't include them):


-- calculate and write level 2, player totals for season

declare abc cursor for
Select distinct playerid from footballstats
where teamid=@teamid and seasonid=@seasonid and levelid=1
open abc
fetch next from abc
into @pid
while @@fetch_status=0

Begin

-- Check season totals record exists for this player, if not insert it.

declare aef cursor for
Select playerid from footballstats
where playerid=@pid and seasonid=@seasonid and levelid=2
open aef
fetch next from aef
if @@fetch_status<>0
begin
Insert Into footballstats (levelid, teamid, seasonid, playerid)
Values (2, @teamid, @seasonid, @pid)
end
close aef
deallocate aef"
   

- Advertisement -