> 唯美句子 > SQL使用while语句求1到100

SQL使用while语句求1到100

SQL使用while 语句求1到100之间的累加和并输出

下面是本人的实验的一个题目,经测试,运行成功,Good Luck。

DECLARE @sum int , @i int

SET @sum = 1

SET @i = 1

WHILE @i<=10

BEGIN

SET @sum = @sum+ @i

SET @i = @i + 1

END

PRINT @sum

我整晚睡不好觉并且整天觉得很累.英语句子

I can't get a good sleep over and overnight and I am exhausted all day.

I can't sleep well all night and I am tired all day.