请教高手:有80多万条数据,要求排序,并取前百分之二的数据.急!!!!!

解决方案 »

  1.   

    declare @i int
    set @i=ceiling((select count(1) from t)*.2)set rowcount @iselect * from t order by col1,col2set rowcount 0
      

  2.   

    declare @i int 
    set @i=ceiling((select count(1) from t)*.02) --*.02=2%set rowcount @i select * from t order by col1,col2 set rowcount 0
      

  3.   


    select top(2) percent 
    FROM * 
    ORDERY COL1,COL2
      

  4.   

    --语法
    select top 2 percent * from 表名 order by 列名[,列表] asc|desc--示例
    select top 2 percent * from sysobjects order by id desc
      

  5.   

    select top 2 percent * from sysobjects order by id desc
      

  6.   


    select top 2 percent * from sysobjects order by id desc 
    --id为聚集索引