Hi All,I have a requirement, in which i have to get list of Item's based on some search criteria. As this requirement is based on paging i'm using Row_Number() method along with 'WITH' and here is my SPCREATE PROCEDURE Items_Search @PageSize INT, @PageIndex INT, @ID INT, @ItemCode VARCHAR(18), @ItemDesc VARCHAR(80), @ItemCategory TINYINT, @Total INT OUTPUT ASBEGIN WITH ITEMSEARCH AS ( SELECT ID, ItemCode, ItemDesc, ItemCategory, Image150x150, Image250x250, Image500x500, ROW_NUMBER() OVER (ORDER BY ID) AS RowNumber FROM ITEMS WHERE (...) ) SELECT * FROM ITEMSEARCH WHERE (RowNumber > ((@PageSize * @PageIndex) - @PageSize) AND RowNumber <= (@PageSize * @PageIndex)) ENDHere my Requirement is to Get the Total Row Count which is got as a result of implementing 'WHERE' condition,the where condition tend to grow as more when more search criteria is added, in that case executing select statementwith the WHERE condition for more than once to get the Total Count and RecordSet will not be goodAnd only one SELECT statement can follow a WITH Class.So as per this condition I need help toExecute the select statement with WHERE clause only once from that i need TOTAL as well as the RecordSet of the SELECT Statement based on Row_Number() Condition.Please raise question if i'm not clear with my problem, so that i'll try to explain it betterThanks