| | |
selecting internal records
Please support our MS SQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
There is no out of the box way to do this with MSSQL but its a common request for web applications so you can show rows 1-10, 11-20, 21-30, etc. on a website. Try googling "MSSQL PAGING" or "MSSQL PAGINATION" and you should come up with a lot of relevant results. There are a number of ways to go about doing this and you will need to choose the one that fits your needs best.
Here is a sample:
I took that code from: http://forloveofsoftware.blogspot.co...ends-here.html
Here is a sample:
sql Syntax (Toggle Plain Text)
With EmployeesCTE as ( SELECT row_number() over (ORDER BY Name) as rownum,* FROM Employees ) SELECT * FROM EmployeesCTE WHERE rownum BETWEEN 291 AND 300 ORDER BY Name
I took that code from: http://forloveofsoftware.blogspot.co...ends-here.html
•
•
Join Date: Nov 2007
Posts: 5
Reputation:
Solved Threads: 0
•
•
•
•
There is no out of the box way to do this with MSSQL but its a common request for web applications so you can show rows 1-10, 11-20, 21-30, etc. on a website. Try googling "MSSQL PAGING" or "MSSQL PAGINATION" and you should come up with a lot of relevant results. There are a number of ways to go about doing this and you will need to choose the one that fits your needs best.
Here is a sample:
sql Syntax (Toggle Plain Text)
With EmployeesCTE as ( SELECT row_number() over (ORDER BY Name) as rownum,* FROM Employees ) SELECT * FROM EmployeesCTE WHERE rownum BETWEEN 291 AND 300 ORDER BY Name
I took that code from: http://forloveofsoftware.blogspot.co...ends-here.html
hi friend,
the above query is useful for only sql server 2005 but not for sqlserver 2000.
i have solution for that
select top 12 * from orders where orderid not in(select top 3 orderid from orders)
u need 4th to 15th records
12 means (15-4)+1=number of records
3 means (4-1)=starting record=removing records
regards,
rathnakar
![]() |
Similar Threads
- login,display,selecting data from database querries (PHP)
- Populating a grid (C#)
- Image upload with description. (PHP)
- PHP & 406 Not Acceptable (PHP)
- Populating Drop Down Menu from database (JSP)
- Display random image from database and... (PHP)
- Renaming Windows Domain DNS File? (Domains and DNS)
- please anybody to help Dropdownlist selected index problem (ASP.NET)
- Selecting one record to many records (MS SQL)
Other Threads in the MS SQL Forum
- Previous Thread: Using IF ELSE in script
- Next Thread: SQL2008.AdventureWorks install problem
| Thread Tools | Search this Thread |






