Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. How to get the next 1,000,000 records

How to get the next 1,000,000 records

Scheduled Pinned Locked Moved Database
helptutorialquestion
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dabuskol
    wrote on last edited by
    #1

    Hi, I have a table with 2,000,000 records and there is no way for me to filter it by range. I was able to get the first 1,000,000, my problem is to get the next 1,000,000 without any duplicates from the first 1M records. Any Idea. SELECT TOP 1000000 * from Table1 how about the next 1M?? Pls..

    Dabsukol

    S M 2 Replies Last reply
    0
    • D dabuskol

      Hi, I have a table with 2,000,000 records and there is no way for me to filter it by range. I was able to get the first 1,000,000, my problem is to get the next 1,000,000 without any duplicates from the first 1M records. Any Idea. SELECT TOP 1000000 * from Table1 how about the next 1M?? Pls..

      Dabsukol

      S Offline
      S Offline
      Satish Developer
      wrote on last edited by
      #2

      Select top 1000000 colname from ( Select top 2000000 colname from urtable order by colname desc ) T order by colname asc

      G. Satish

      Z 1 Reply Last reply
      0
      • S Satish Developer

        Select top 1000000 colname from ( Select top 2000000 colname from urtable order by colname desc ) T order by colname asc

        G. Satish

        Z Offline
        Z Offline
        zahedonline
        wrote on last edited by
        #3

        In short For First 1000000 Select top 1000000 colname from urtable order by colname ASC For Next 1000000 Select top 1000000 colname from urtable order by colname DESC

        ZAK

        M 1 Reply Last reply
        0
        • Z zahedonline

          In short For First 1000000 Select top 1000000 colname from urtable order by colname ASC For Next 1000000 Select top 1000000 colname from urtable order by colname DESC

          ZAK

          M Offline
          M Offline
          Mycroft Holmes
          wrote on last edited by
          #4

          Oops just added another record - this is a Microsoft answer, technically correct practically useless.

          Never underestimate the power of human stupidity RAH

          1 Reply Last reply
          0
          • D dabuskol

            Hi, I have a table with 2,000,000 records and there is no way for me to filter it by range. I was able to get the first 1,000,000, my problem is to get the next 1,000,000 without any duplicates from the first 1M records. Any Idea. SELECT TOP 1000000 * from Table1 how about the next 1M?? Pls..

            Dabsukol

            M Offline
            M Offline
            Mycroft Holmes
            wrote on last edited by
            #5

            Select top 1m records order by ID Get the last ID in the first set (you do have an ID field) Select the top 1m records where ID > last ID You can also look into Row_Number in SQL Server, this will eliminate the detect requirement but is more complex in the select. I would assume you are processing the 1m records and therefore detecting the last ID would be trivial.

            Never underestimate the power of human stupidity RAH

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups