Sql 组织编写语句
declare @one int,@tow int,@str varchar(100),@num int
select @one=1
while(@one<=9)
begin
select @tow=1,@str=''
while(@tow<=@one)
begin
set @num =@tow*@one --求积
set @str+=' '+convert(varchar,@tow)+'*'+convert(varchar,@one)+'='+convert(varchar,@num) --拼接字符串
set @tow=@tow+1
end
print @str
set @one=@one+1
end
结果样式: