Why use Select Top 100 Percent?

后端 未结 10 2319
花落未央
花落未央 2020-11-27 15:41

I understand that prior to SQL Server 2005, you could \"trick\" SQL Server to allow use of an order by in a view definition, by also include TOP 100 PERCENT

10条回答
  •  孤街浪徒
    2020-11-27 16:06

    I would suppose that you can use a variable in the result, but aside from getting the ORDER BY piece in a view, you will not see a benefit by implicitly stating "TOP 100 PERCENT":

    declare @t int
    set @t=100
    select top (@t) percent * from tableOf
    

提交回复
热议问题