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. Problem with SQL 2005 Express: View Sorting Order

Problem with SQL 2005 Express: View Sorting Order

Scheduled Pinned Locked Moved Database
databasesql-serversysadminalgorithmshelp
3 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
    nguyenvhn
    wrote on last edited by
    #1

    Hello everybody I have a problem with SQL Server 2005 Express. Here are description: In a database, there is a table, name TEST with three columns: a(int), b(int), c(char). I created a view as the following: CREATE VIEW [dbo].[view_test] AS SELECT TOP (100) PERCENT A, B, C FROM dbo.Test ORDER BY A, B Clearly, I want the result set ordered by column A and B. Then I executed the folowing query: SELECT * FROM view_test But the result is not sorted. In SQL Server 2000, the problem does not happend. Is there any comment? Thanks so much.

    F E 2 Replies Last reply
    0
    • N nguyenvhn

      Hello everybody I have a problem with SQL Server 2005 Express. Here are description: In a database, there is a table, name TEST with three columns: a(int), b(int), c(char). I created a view as the following: CREATE VIEW [dbo].[view_test] AS SELECT TOP (100) PERCENT A, B, C FROM dbo.Test ORDER BY A, B Clearly, I want the result set ordered by column A and B. Then I executed the folowing query: SELECT * FROM view_test But the result is not sorted. In SQL Server 2000, the problem does not happend. Is there any comment? Thanks so much.

      F Offline
      F Offline
      Farhan Noor Qureshi
      wrote on last edited by
      #2

      Sorting inside a view is not a SQL standard and its not suppose to work in SQL2K5. It worked in SQL2K but it was not a good choice.


      Farhan Noor Qureshi

      1 Reply Last reply
      0
      • N nguyenvhn

        Hello everybody I have a problem with SQL Server 2005 Express. Here are description: In a database, there is a table, name TEST with three columns: a(int), b(int), c(char). I created a view as the following: CREATE VIEW [dbo].[view_test] AS SELECT TOP (100) PERCENT A, B, C FROM dbo.Test ORDER BY A, B Clearly, I want the result set ordered by column A and B. Then I executed the folowing query: SELECT * FROM view_test But the result is not sorted. In SQL Server 2000, the problem does not happend. Is there any comment? Thanks so much.

        E Offline
        E Offline
        Eric Dahlvang
        wrote on last edited by
        #3

        What datatypes are you using for columns A and B? Order By in a SQLExpress view works fine for me. If you hit F1 in "Microsoft SQL Server Management Studio Express" while in the View Designer, you are taken to: http://msdn2.microsoft.com/en-us/library/ms172014.aspx[^] which explains Sort Type and Sort Order for views.

        --EricDV Sig--------- Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peters

        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