declare @a as varchar(10)
set @a= '1'
declare @sql as varchar(1000)
declare @b as varchar(20)
set @b = '1'
while (@a<=5)
begin
select @sql= '
select ['+@a+'] from #Seg1PD_TruncadaFinal where truncada ='+@b+'
union all
select ['+@b+'] from #Seg1PD_TruncadaFinal where truncada ='+@a
exec(@sql)
set @a=@a+1
end
我有这个代码,我的目标是创建一个像矩阵一样繁殖表的过程,所以我试图创建一个程序来复制它。
我在考虑3个循环并将单元格1x1与1x1加1x2单元格乘以2x1 ...
但不是联盟,而是像产品一样。
抱歉,非常感谢!!