Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jul 28, 2010 06:53 AM by Mikesdotnetting
Jul 27, 2010 01:07 PM|LINK
i want to select rows between 15 to 30 from sql server so i am writing this:
WHERE (rownum > 14) AND (rownum < 31)
but i am getting error: "No value given for one or more required parameter" ..
plz reply me..
Jul 27, 2010 03:37 PM|LINK
try like this
SELECT * FROM
SELECT ROW_NUMBER() OVER(ORDER BY YourColumns) NUM,
* FROM YOURTABLE
WHERE NUM >14 AND NUM <31
You have to calculate the row number and then apply the filter
Jul 28, 2010 06:31 AM|LINK
thanks for reply ,
after applying this query i am getting error:" ROW_NUMBER is not a recognizes function name". I am using sql server 2000
plz reply me
Jul 28, 2010 06:43 AM|LINK
Honestly, I'm sorry I have never worked on SQL Server 2000. I think that Row Number function is from 2205.
check this link:
Jul 28, 2010 06:53 AM|LINK
If you are using SQL Server 2000, you have a number of options which are explained here:
http://databases.aspfaq.com/database/how-do-i-page-through-a-recordset.html. The article looks at paging records in classic ASP. so the first half of the article is irrelevant, but further down, there are a number of stored procedure options that work.
Aaron Bertrand found the last Stored Procedure options - the one that uses ROWCOUNT to be the best performer. Don't just grab the first one in the list.