出100的几率小的(要差不多的话把*50改*51,不过这样要判断101的情况……
50+floor(rand()*50)

解决方案 »

  1.   

    SELECT TOP 100
    id = identity(int,1,1) 
    INTO # FROM syscolumns a, syscolumns b   
    select top 1 id from # where id>=50 order by newid()drop table #
      

  2.   

    declare @a int
    set @a=(SELECT convert(int,RAND( (DATEPART(mm, GETDATE()) * 100000 )
               + (DATEPART(ss, GETDATE()) * 1000 )
               + DATEPART(ms, GETDATE()) )*100))
    if 
    @a<50
      begin
        select @a+50
      end
    else
      begin
        select @a
      end