CREATEPROCEDURE[dbo].[spGetResultNumber] AS Begin Select RecordID, Name,Gender into #tempResult from tblSample Select @recordsNum=count(RecordID) From #tempResult end GO
spGetResult
CREATEPROCEDURE[dbo].[spGetResult] @startIndex int, @endIndex int AS Begin --New a field PKID for paging Selectidentity(int,1,1) as PKID, RecordID, Name,Gender into #tempResult from tblSample Select*from #tempResult where PKID between @startIndex and @endIndex end GO