With T
As
(
Select 1 As A
Union all
Select A+1 From T Where A<9
)
Select [1],[2],[3],[4],[5],[6],[7],[8],[9]
From
(
Select M.A As MA,N.A As NA,
Convert(Varchar(2),M.A)+'*'+
Convert(Varchar(2),N.A)+'='+
Convert(Varchar(2), Case When M.A<=N.A Then M.A*N.A Else null End )As rst
From T M Cross Join T N
) s
Pivot
(
Max(rst)
For MA in([1],[2],[3],[4],[5],[6],[7],[8],[9])
) pvt