Re: ORDER BY in VIEW not working
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Thu, 23 Mar 2006 08:29:42 +0000 (UTC)
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
.
- Follow-Ups:
- Re: ORDER BY in VIEW not working
- From: RickW
- Re: ORDER BY in VIEW not working
- References:
- Re: ORDER BY in VIEW not working
- From: Erland Sommarskog
- Re: ORDER BY in VIEW not working
- From: RickW
- Re: ORDER BY in VIEW not working
- Prev by Date: Re: ORDER BY in VIEW not working
- Next by Date: Update the salary of each manager to be double the average salary of the employees he/she manages
- Previous by thread: Re: ORDER BY in VIEW not working
- Next by thread: Re: ORDER BY in VIEW not working
- Index(es):
Relevant Pages
|