[Solved] How to Select A number of data of table record, but before apply a condition on this record?
To expand on my comment about moving the [Gu-Id] IS NULL, try this: ALTER PROC [dbo].[SPFetchAllDisActiveUser] ( @StartRowIndex INT, @MaxRows INT ) AS BEGIN SELECT * FROM ( SELECT *, ROW_NUMBER() OVER(ORDER BY [User-ID] ASC) AS RowNum FROM [User-Tbl] WHERE [Gu-Id] IS NULL ) AS DisActiveUser WHERE RowNum BETWEEN @StartRowIndex + 1 AND @MaxRows; END … Read more