Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

same in SQL Server

   declare @i float =0.37,@times int = 0,@total float = 0

   while @times < 5000
   begin
   set  @total+=  @i
   set @times +=1
   end

   select @total
1849.99999999977

or

   select sum(t) from(
   select top 5000 convert(float, 0.37) t 
   from sysobjects a cross join sysobjects b) z
1849.99999999977


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: