Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to get records based on start,end positions?

Status
Not open for further replies.

desaivar

Programmer
Jul 6, 2009
12
US
Hi there,

I want to create store procedure where I can pass starting positon and end position for records as parameters and based on that I can retrieve record set.

For ex. if I pass starting position as 6th and end position as 11th then I should be able to retrieve records from 6th to 11th for select statement which I written.

I want to achieve this functionality for custom paging in grid on web page.

I have already watched cetain articles on internet for writing store procedure for custom paging of the grid but they don't match to my criteria.

Is there any way I can achieve set of records based on starting position and end position?

I am exlploring on this issue lot but till no success. Your help would be precious for me.

Thanks in advance.
 
Here's an example:

Code:
DECLARE @Start INT
DECLARE @End INT

SELECT @Start = 6
SELECT @End = 11

SELECT * FROM
	(SELECT ROW_NUMBER() OVER(ORDER BY COLUMN_NAME ASC) AS RN, * 
	FROM INFORMATION_SCHEMA.COLUMNS) x
WHERE RN BETWEEN @Start AND @End
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top