Code:
SELECT @min_postid = postid
FROM post
WHERE ...
ORDER BY postid ASC
SET ROWCOUNT @perpage
-- we know where we want to go (say the 28th post in a set of 50).
SELECT ...
FROM post
WHERE postid >= @min_postid
...
ORDER BY postid ASC
Well, the code was for a forum system like this, so you only want to display a certain subset of posts on a given page. PostID, in this case, is an IDENTITY column although it could be any sort of sortable column.
You first determine how many posts you want per page then calculate how many rows you need to offset (posts per page * page number to display). You then iterate through all of your posts to get the postID which is the first post to be displayed. This is @min_postid. You can then say "Show me all posts greater/equal to @min_postID and stop after #per_page of them).