Is there are any option/query to read block of rows at one time and then query again for next page ?
i.e In MYSQL have LIMIT clause with Select Statement
Please let me know..
Database : SQL Server 2000/2005,
Thanks in Advance
Laxmilal
Whenever you use Select statement you must use WHERE condition to limit the rows.
Eg.
Select col1,col2.... From Tablename WHERE someid between 1 and 1000
Madhu
|||You 'Machine not responding' is most likely due to waiting for millions of rows to come back from the server.
You really need to limit the quantity of data that you are requesting from SQL Server. Without WHERE clause criteria that enforces limits, you are unnecessarily wasting bandwidth (and time) as more data than you need for the operation at hand is being transported to the client application.
With SQL 2005, you may wish to explore using the new ROW_NUMBER() function to assist in retrieving specific 'blocks' of rows.
Referring to Books Online, Topic: ROW_NUMBER()
Example:
USE AdventureWorks; GOWITH OrderedOrders AS ( SELECT SalesOrderID, OrderDate, ROW_NUMBER() OVER (ORDER BY OrderDate) AS 'RowNumber' FROM Sales.SalesOrderHeader ) SELECT * FROM OrderedOrders WHERE RowNumber BETWEEN 50 AND 60;(You should be able to adapt this concept for your needs.)
No comments:
Post a Comment