You are here: Re: ORDER BY in VIEW not working « MsSQL Server « IT news, forums, messages
Re: ORDER BY in VIEW not working

Posted by Erland Sommarskog on 03/23/06 10:29

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@sommarskog.se

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация