Why would we use SELECT TOP 100 PERCENT??

  • Hi..

    I have basic level question..

    Why would we use SELECT TOP 100 PERCENT in a SQL Server 2000 query?


    Regards,

    Papillon

  • >>Why would we use SELECT TOP 100 PERCENT in a SQL Server 2000 query

    The most common use I've seen for this is to implement an unsupported relational DB feature - including an ORDER BY in a view.

    A view should contain no inherent order in its resultset. However, you can fake/hack an "ordered view" by using TOP 100 PERCENT in conjunction with ORDER BY

  • Note, this was undocumented behaviour in SQL2000  and shouldn't have been relied on. It has been broken in SQL2005. See the last sections of this link on SQL2005 view behaviour with TOP/ORDER BY:

    http://msdn2.microsoft.com/en-us/library/ms188723(SQL.90).aspx

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply