Home > database >  SQL server to print my multiplication tables I will double Yang, but I'm unlikely to print back
SQL server to print my multiplication tables I will double Yang, but I'm unlikely to print back

Time:09-20

CodePudding user response:

DECLARE @ a smallint, @ b smallint, @ STR varchar (1000)
The set @ a=1 while @ a<=9
The begin
The SET @ b=1 SET @ STR='WHILE @ b<=@ a
Begin the SELECT @ STR=@ STR + convert (varchar (1), @ b) + '*' + convert (varchar (1), @ a) + '=' + convert (char (2), @ a * @ b) + space (2) the SET @ b=@ b + 1 end PRINT @ STR SET @ a=@ a + 1 end

CodePudding user response:

 
DECLARE @ a smallint, @ b smallint, @ STR varchar (1000)
The set @ a=9
WHILE @ a>=1
The begin
The SET @ b=1
The SET @ STR='
WHILE @ b<=@ a
The begin
SELECT @ STR=@ STR + convert (varchar (1), @ b) + '*' + convert (varchar (1), @ a) + '=' + convert (char (2), @ a * @ b) + space (2)
The SET @ b=@ b + 1
END
PRINT @ STR
The SET @ a=@ a - 1
END

CodePudding user response:

  • Related