declare @sum int,@count int
select @sum=0,@count=0
label_1:
select @[email protected]+1
select @[email protected][email protected]
if @count<=6
goto label_1
select @count ‘数值‘,@sum ‘1~7累加和‘
运行结果:
时间: 2024-08-03 22:48:32
declare @sum int,@count int
select @sum=0,@count=0
label_1:
select @[email protected]+1
select @[email protected][email protected]
if @count<=6
goto label_1
select @count ‘数值‘,@sum ‘1~7累加和‘
运行结果: