declare @i int=0,@sum int=0 while(@i<=100) begin if(@i%2!=0) begin set @sum=@sum+@i; end set @i=@i+1 end