I am trying to search records and display but it is slow in returned values the table has over 2000 records.
ALTER PROCEDURE [dbo].[Files_GetFiles_Pager]
@SearchTerm VARCHAR(100) = ''
,@PageIndex INT = 1
,@PageSize INT = 10
,@RecordCount INT OUTPUT
AS
BEGIN
SET NOCOUNT ON;
SELECT ROW_NUMBER() OVER
(
ORDER BY [admno] ASC
)AS RowNumber
,[Name]
, admno as [Id]
,photo as [Data],Class,Stream,Status
INTO #Results
FROM P3P7
WHERE ([Name] LIKE @SearchTerm or [Name] LIKE '%'+@SearchTerm+'%' or [Name] LIKE '%' + @SearchTerm or [Name] LIKE @SearchTerm + '%') OR @SearchTerm = '' OR @SearchTerm = ''
SELECT @RecordCount = COUNT(*)
FROM #Results
SELECT * FROM #Results
WHERE RowNumber BETWEEN(@PageIndex -1) * @PageSize + 1 AND(((@PageIndex -1) * @PageSize + 1) + @PageSize) - 1
DROP TABLE #Results
END