Home > database >  With the knowledge that programming for 1 2 3 4 5 6 7 8 9 10 results.
With the knowledge that programming for 1 2 3 4 5 6 7 8 9 10 results.

Time:09-21

Pray god solve beginner's white

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
  • Related