Skip to content

Instantly share code, notes, and snippets.

@Spaider
Last active August 29, 2015 14:00
Show Gist options
  • Save Spaider/11206888 to your computer and use it in GitHub Desktop.
Save Spaider/11206888 to your computer and use it in GitHub Desktop.
Begin
Declare @aiRacerID Int
Declare @row Int
Declare @page Int = 1
Declare @pageSize Int = 10000
Set Nocount On
Declare spCursor Cursor fast_forward
For
With Racers As (
Select tracer.RCR_RacerID,
ROW_NUMBER() OVER (ORDER BY RCR_RacerID) AS RowNumber
From vr_t_RacerDetail tracer with (nolock)
)
Select RowNumber, RCR_RacerID
From Racers with (nolock)
Where RowNumber Between (@page - 1) * @pageSize + 1 And @page * @pageSize
Open spCursor
While 1=1
Begin
Fetch Next From spCursor Into @row, @aiRacerID;
If @@fetch_status=-1
Break
If @@fetch_status=-2
Continue
If @row % 100=0
Print @row
Execute pr_vr_SaveCoursePatternRankingsAllForRacer @aiRacerID
End;
Close spCursor;
Deallocate spCursor
Set Nocount On
End
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment