SQL while 循环

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

 

posted @ 2017-08-02 16:04  风儿_VIP  阅读(141)  评论(0编辑  收藏  举报