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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. how to update table after query

how to update table after query

Scheduled Pinned Locked Moved Database
databasetutorialannouncement
4 Posts 3 Posters 1 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.
  • N Offline
    N Offline
    nibabug
    wrote on last edited by
    #1

    i write like this: SELECT * FROM TB_ANGEL ORDER BY angel ASC but i want not only query by order, i also want update the table by order thanks a lot:)

    wuhuaiji

    J 1 Reply Last reply
    0
    • N nibabug

      i write like this: SELECT * FROM TB_ANGEL ORDER BY angel ASC but i want not only query by order, i also want update the table by order thanks a lot:)

      wuhuaiji

      J Offline
      J Offline
      John ph
      wrote on last edited by
      #2

      Records in the table are physically sorted in the order of the Primary key Column by default. You can't update the order of the records programmatically.

      Regards
       - J O N -


      M 1 Reply Last reply
      0
      • J John ph

        Records in the table are physically sorted in the order of the Primary key Column by default. You can't update the order of the records programmatically.

        Regards
         - J O N -


        M Offline
        M Offline
        Mike Dimmick
        wrote on last edited by
        #3

        Actually they are physically sorted in the order of the clustered index information - that's what 'clustered index' means. However, it is the default to build the index supporting the primary key as the clustered index. Tables without a clustered index are not sorted and are referred to as 'heaps'. Specific rows in a heap are referred to internally using row identifiers which give the physical location of the row, but this information isn't available to clients. If you wish to update a specific row, you need to include some kind of row identifier within the table such that each row has its own identifier. SQL Server 2005 does provide the RANK function which might prove helpful for updating an ad-hoc query.


        DoEvents: Generating unexpected recursion since 1991

        N 1 Reply Last reply
        0
        • M Mike Dimmick

          Actually they are physically sorted in the order of the clustered index information - that's what 'clustered index' means. However, it is the default to build the index supporting the primary key as the clustered index. Tables without a clustered index are not sorted and are referred to as 'heaps'. Specific rows in a heap are referred to internally using row identifiers which give the physical location of the row, but this information isn't available to clients. If you wish to update a specific row, you need to include some kind of row identifier within the table such that each row has its own identifier. SQL Server 2005 does provide the RANK function which might prove helpful for updating an ad-hoc query.


          DoEvents: Generating unexpected recursion since 1991

          N Offline
          N Offline
          nibabug
          wrote on last edited by
          #4

          thanks a lot:)

          wuhuaiji

          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