Re: ORDER BY in VIEW not working



RickW (user=wannall at=@ other=sbcglobal final=.net) writes:
Obviously I need someone to explain why, if it's okay to use ORDER BY in
a query to get an ordered data set, it's not okay to store that query as
a view in a tool like SQL Server and see that ordered result in my
application, without having to write a query from the application.

A view is not a query. If you want stored queries, use stored procedures.
The purpose of a view is gather information from one or more tables, to
make it easier for end users to work with the data, or to hide information
they are not supposed to see. But it is still an unordered set of
information.

I agree with Herb. It was lazy of Microsoft to omit a solution to this.

There are stored procedures, and thus there is a solution.

What was a mistake was to supply a syntax that lead you to believe that
you could do this.


--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.



Relevant Pages

  • Re: Wanted: Discussion on MSSQL Internals Interview Qustions
    ... Developer for Microsoft's SQL Server team? ... Other inputs the query optimizer uses are the schema ... The C# dataset caching can only cache results from a single query. ... I don't consider these alternatives to stored procedures, ...
    (microsoft.public.sqlserver.programming)
  • Re: CONTAINS performance
    ... That said, and with the query plan, I can start to give you more ... relational join in the context of the free-text optimization, ... SQL Server tables. ...
    (microsoft.public.sqlserver.fulltext)
  • Re: SQL Server
    ... Where is the processing done in a pass through query? ... One of the SQL Server programmers is pushing stored procedures, ... pass-through queries. ...
    (microsoft.public.access.queries)
  • Re: Indexing Service, Openquery and sp_executesql
    ... SQL Server version and sp are you running? ... > data from the indexing service catalog when pasted into ... > query analyzer, but failed when put against sp_executesql ... I would choose Microsoft Indexing ...
    (microsoft.public.sqlserver.fulltext)
  • Re: Problem using Access or Query Designer to run queries in SQL Serve
    ... >or Query Designer within Enterprise Manager, it works and I get data back. ... >ODBC Call Failed [ODBC SQL Server Driver] Timeout Expirederror in Access ... >[ODBC SQL Server Driver] Timeout Expired ...
    (microsoft.public.sqlserver.odbc)