Solved

Help

Posted on 1998-12-04
1
223 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Join & Write a Comment

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

708 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now