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