You are here: Re: View Order Dissappearing « MsSQL Server « IT news, forums, messages
Re: View Order Dissappearing

Posted by Russ Rose on 12/19/06 00:37

"Erland Sommarskog" <esquel@sommarskog.se> wrote in message
news:Xns989B7877F6E6EYazorman@127.0.0.1...
> Russ Rose (russrose@hotmail.com) writes:
>> "Hurricane" <mgreenway@gmail.com> wrote in message
>> news:1166213549.389511.148520@t46g2000cwa.googlegroups.com...
>>> When I create a view in SQL and include an ORDER BY clause i can see it
>>> in Management Studio. However, when I call the same view from an ASP
>>> page the order goes completely haywire.
>>>
>>>
>>> Any ideas?
>>>
>>
>> Does your view specify TOP 100 PERCENT?
>>
>> CREATE VIEW dbo.OrderByDateView
>>
>> AS
>>
>> SELECT TOP 100 PERCENT Field1, Field2, Date1
>> FROM Table1
>> ORDER BY Date1
>
> To clarify David's post: on SQL 2000 the above appears to work. That is,
> if you say "SELECT * FROM Table1" the data comes back in the same order as
> the ORDER BY clause most of the time. However, that is mere chance, and in
> SQL 2005 it does not happen that often at all.
>
> Logically the TOP 100 PERCENT and the ORDER BY means nothing at all.

Would it mean nothing at all if requesting 10%?

>
> --
> 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

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