时间:2021-07-01 10:21:17 帮助过:2人阅读
sql语句实现--X 右下角九九乘法表
DECLARE @I INT ,@J INT,@S VARCHAR() SET @I= WHILE @I< BEGIN SET @J= SET @S=‘‘ WHILE @J> BEGIN IF @J>@I BEGIN SET @S=@S+‘ ‘ --七个空格 END ELSE BEGIN SET @S=@S+CAST(@I AS CHAR())+‘*‘+CAST(@J AS CHAR())+‘=‘+CAST((@I*@J)AS CHAR()) END SET @J=@J- END PRINT @S SET @I=@I+ END
sql语句实现--9X9右上角
DECLARE @I INT ,@J INT,@S VARCHAR(100) SET @I=1 WHILE @I<10 BEGIN SET @J=1 SET @S=‘‘ WHILE @J<10 BEGIN IF @J<@I BEGIN SET @S=@S+‘ ‘--7 END ELSE BEGIN SET @S=@S+CAST(@I AS CHAR(1))+‘*‘+CAST(@J AS CHAR(1))+‘=‘+CAST((@I*@J)AS CHAR(3)) END SET @J=@J+1 END PRINT @S SET @I=@I+1 END
sql语句实现--9X9左上角
DECLARE @I INT ,@J INT,@S VARCHAR(100) SET @I=1 WHILE @I<10 BEGIN SET @J=@I SET @S=‘‘ WHILE @J<10 BEGIN SET @S=@S+CAST(@I AS CHAR(1))+‘*‘+CAST(@J AS CHAR(1))+‘=‘+CAST((@I*@J)AS CHAR(3)) SET @J=@J+1 END PRINT @S SET @I=@I+1 END
SQL-语句实现九九乘法表
标签: