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. Splitting large amounts of data in a table

Splitting large amounts of data in a table

Scheduled Pinned Locked Moved Database
questiondatabasesql-serversysadmin
4 Posts 4 Posters 2 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.
  • P Offline
    P Offline
    Pita32
    wrote on last edited by
    #1

    Is there a way to split data into two separate tables with a single SQL statement? I know that sounds like an odd question, but I have a large table in terms of rows, and I would like to "split" the data into two separate tables for separate processing in parallel fashion. Call me crazy but I thought there was a way to do that in SQL Server, i.e. a SQL statement to divide the table into two separate tables. Is there a way to do that or am I misremembering?

    M L V 3 Replies Last reply
    0
    • P Pita32

      Is there a way to split data into two separate tables with a single SQL statement? I know that sounds like an odd question, but I have a large table in terms of rows, and I would like to "split" the data into two separate tables for separate processing in parallel fashion. Call me crazy but I thought there was a way to do that in SQL Server, i.e. a SQL statement to divide the table into two separate tables. Is there a way to do that or am I misremembering?

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

      Take a look at partitioning although I would be wary of physically splitting a table simply for parallel processing, there are probably better ways of doing the job.

      Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP

      1 Reply Last reply
      0
      • P Pita32

        Is there a way to split data into two separate tables with a single SQL statement? I know that sounds like an odd question, but I have a large table in terms of rows, and I would like to "split" the data into two separate tables for separate processing in parallel fashion. Call me crazy but I thought there was a way to do that in SQL Server, i.e. a SQL statement to divide the table into two separate tables. Is there a way to do that or am I misremembering?

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Just run two selects ("in one statement"). Select "top half" (count / 2) in one case, select the rest for the other (not in; greater than; whichever).

        It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food

        1 Reply Last reply
        0
        • P Pita32

          Is there a way to split data into two separate tables with a single SQL statement? I know that sounds like an odd question, but I have a large table in terms of rows, and I would like to "split" the data into two separate tables for separate processing in parallel fashion. Call me crazy but I thought there was a way to do that in SQL Server, i.e. a SQL statement to divide the table into two separate tables. Is there a way to do that or am I misremembering?

          V Offline
          V Offline
          Victor Nijegorodov
          wrote on last edited by
          #4

          Why not implement it in a procedure?

          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