Sql server编写九九乘法表
declare @a smallint,
@b smallint,
@str varchar(1000)
set @a=1
while @a<=9
begin
set @b=1
set @str=''
while @b<=@a
begin
select @str=@str+convert(varchar(1),@b)+'*'+convert(varchar(1),@a)+'='+convert(char(2),@a*@b)+space(2)
set @b=@b+1
end
print @str
set @a=@a+1
end