• Alan.B (7/14/2014)


    TOP 100 PERCENT is not a kludge nor is TOP <really big number>.

    It is kinda. TOP (100) PERCENT ... ORDER BY will result in SQL ignoring the order by in a view because it's not a row-limiting top. Whether the optimiser will get smart enough to realise that TOP (really large number) is also not a row limiting top and hence will allow it to ignore the order by is an open question. It's probably not something that will be indicated as deprecated if it ever happens, because it's used to evade the SQL rule that only and ORDER BY on the outer-most select has any effect on the ordering.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass