Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Select top, how to get the rest? Expand / Collapse
Author
Message
Posted Tuesday, March 23, 2010 2:14 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, April 6, 2011 12:59 PM
Points: 7, Visits: 47
Hi

I want to use paging and I don't want to get so many records.
But if I use select top (100) for example, how will I get the rest of the records, split in 100 per each select query. I have seen example like this
SELECT TOP (100) OrderDate, ShipName FROM orders WHERE orderID NOT IN (SELECT TOP OFFSET OrderID FROM orders)
. But I have read and tried that Offset doesn't work in SQL Server. Is there anything else I can do?

Thanks

Fia
Post #888512
Posted Tuesday, March 23, 2010 2:19 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 9:11 PM
Points: 23,070, Visits: 31,598
Start by reading this article: http://www.sqlservercentral.com/articles/Advanced+Querying/3181/



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #888519
Posted Tuesday, March 23, 2010 7:44 PM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 4:24 PM
Points: 4,011, Visits: 6,082
This one might be of interest too.

__________________________________________________

Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? -- Stephen Stills
Post #888645
Posted Thursday, October 3, 2013 3:32 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, November 5, 2013 3:19 AM
Points: 1, Visits: 1
You can check this SQL Data with REST interface or can work out your own code with testing environment of SQL server debugging.
Post #1501080
Posted Thursday, October 3, 2013 7:39 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, October 31, 2013 3:44 AM
Points: 314, Visits: 4,128

As an FYI, the use of OFFSET in the ORDER BY Clause would be valid for SQL Server 2012.

http://technet.microsoft.com/en-us/library/ms188385.aspx
Post #1501184
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse