Solved

Help

Posted on 1998-12-04
1
248 Views
Last Modified: 2010-03-19
When I select certain post from a table, it can be too many hits, so I want that there are only the first 50 hits shows then you choose Previous 50 or next 50 etc, and also show where you are like (1-50)of 170, How can I do on a nice way?
0
Comment
Question by:ruisun
1 Comment
 
LVL 3

Accepted Solution

by:
cognition earned 50 total points
ID: 1092088
You could use an IDENTITY column and also the SET ROWCOUNT n within a stored procedure.

CREATE PROCEDURE GetPost
@nlastident int,
@nNumberToGet tinyint
AS

SET ROWCOUNT @nNumberToGet

SELECT *
FROM Post
WHERE Post.identitycolumn > @nlastident

SET ROWCOUNT 0

You could also use a datetime column instead of an IDENTITY column.



0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Help Required 2 30
SSRS 2012 r2 - Parm Drop Down has Date/Time 12 31
SQL Server - Find Parent/Child relationship tree between numeric range. 7 41
Sql Server group by 10 26
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question