declare @i int, @j int , @str varchar(100)
set @i=0
set @j=0
print '***************************九九乘法表****************************'
while(@i<=9) --行数
begin
while(@j<=@i) --个数
begin
set @str=@str + cast(@j as varchar(2)) + '*' + cast(@i as varchar(2)) + '=' +cast(@i*@j as varchar(2)) +' '
set @j=@j+1
end --内层循环的结束
print @str
set @str=''
set @i=@i +1
set @j=1
print ''
end
转载于:https://www.cnblogs.com/zhangxudong-cnblogs/p/10878003.html