我想用T-SQL语句打印一个九九乘法表,但是总是换行,哪位有好的方法让
2*1 2*2 在一行显示
------解决方案--------------------
- SQL code
declare @str varchar(max)declare @num1 int ,@num2 intselect @num1=1,@num2=1while(@num1<10)begin set @num2=1 while(@num2<[email protected]) begin set @str = isnull(@str,'')+ltrim(@num1)+'*'+ltrim(@num2)+'='+right([email protected][email protected],2)+' ' set @[email protected]+1 end set @[email protected]+1 set @str = isnull(replace(@str,'=0','= '),'') + char(13)endprint @str