Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    911
    Thanks
    302
    Thanked 2 Times in 2 Posts

    Question MS SQL Server 2000/2003/2008

    Hi

    A simple yet weird question for MS SQL Server 2000/2003/2008 users.

    I have a table with 100 rows and there is NO auto-id number in that table. How do I fetch the x number of records from nth location?



    Thanks

  • #2
    New to the CF scene
    Join Date
    Feb 2010
    Location
    Williamsburg, VA
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The query is a bit convoluted:

    SELECT * FROM(
    SELECT row_number() OVER (ORDER BY date_entered) AS rownum,
    name, date_entered
    FROM accounts) AS A
    WHERE A.rownum BETWEEN (100) AND (200)

    In this example, we are selecting records 100 to 200, ordered by the date_entered column. We are selected the name and date_entered columns from the accounts table.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •