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. Other Discussions
  3. The Weird and The Wonderful
  4. SQL Server Management Studio's ordered view

SQL Server Management Studio's ordered view

Scheduled Pinned Locked Moved The Weird and The Wonderful
databasesql-servercomsysadminbeta-testing
4 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.
  • B Offline
    B Offline
    Bernhard Hiller
    wrote on last edited by
    #1

    Actually I wanted to post a "normal" programming question, but a search thru the web showed me that Microsoft produced a coding horror: In SQL Server Management Studio, create a view and add an "ORDER BY" clause. When you are still in the designer, and click the "!" to execute the view, the result will be as expected: correctly sorted. Now save the view, and and query its data. Never will you get the expected sort order... See http://connect.microsoft.com/SQLServer/feedback/details/249248/management-studio-generates-invalid-top-100-percent-order-by-in-views[^]

    P 1 Reply Last reply
    0
    • B Bernhard Hiller

      Actually I wanted to post a "normal" programming question, but a search thru the web showed me that Microsoft produced a coding horror: In SQL Server Management Studio, create a view and add an "ORDER BY" clause. When you are still in the designer, and click the "!" to execute the view, the result will be as expected: correctly sorted. Now save the view, and and query its data. Never will you get the expected sort order... See http://connect.microsoft.com/SQLServer/feedback/details/249248/management-studio-generates-invalid-top-100-percent-order-by-in-views[^]

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #2

      The horror is allowing creation of a view with an order by in the first place. X| Just say no.

      C R 2 Replies Last reply
      0
      • P PIEBALDconsult

        The horror is allowing creation of a view with an order by in the first place. X| Just say no.

        C Offline
        C Offline
        Chris Meech
        wrote on last edited by
        #3

        My thoughts exactly.

        Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

        1 Reply Last reply
        0
        • P PIEBALDconsult

          The horror is allowing creation of a view with an order by in the first place. X| Just say no.

          R Offline
          R Offline
          robocodeboy
          wrote on last edited by
          #4

          Well, Order By is of some use, even in views. But it should ALWAYS be paired with a TOP(X).

          SELECT TOP 100 PERCENT *
          FROM Somewhere
          ORDER BY whatever

          is a true, classic, horror.

          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