Why use Select Top 100 Percent?

后端 未结 10 2293
花落未央
花落未央 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:02

    Kindly try the below, Hope it will work for you.

          SELECT TOP
                  ( SELECT COUNT(foo) 
                      From MyTable 
                     WHERE ISNUMERIC (foo) = 1) * 
                      FROM bar WITH(NOLOCK) 
                  ORDER BY foo
                     WHERE CAST(foo AS int) > 100
                   )
    

提交回复
热议问题