34,838
社区成员




create table score(id bigint, score float)
declare @i int
declare @temp int
set @i=0
while @i<1000000
begin
set @temp=abs(checksum(newid()))
insert score select @temp%100, @temp%6*0.5
set @i=@i+1
end
declare @time datetime
select @time=getdate()
select *, 'ABCDEF'=char(score*2+65) from score
print datediff(ms,@time,getdate())
select @time=getdate()
select *, 'ABCDEF'=case score when 0 then 'A'
when 0.5 then 'B'
when 1 then 'C'
when 1.5 then 'D'
when 2 then 'E'
when 2.5 then 'F' end
from score
print datediff(ms,@time,getdate())
drop table score
/* Messages
(1000000 row(s) affected)
13350
(1000000 row(s) affected)
13893
*/