CodePudding user response:
DECLARE @ Number INT=1;DECLARE @ Total INT=0;
WHILE @ Number & lt;=10
The BEGIN
The SET @ Total=@ Total + @ Number;
The SET @ Number=@ Number + 1;
END
PRINT @ Total;
CodePudding user response:
declare @ I=1, @ iMax=10;
Select (@ I + @ iMax) * @ iMax/2