DECLARE @s NVARCHAR(MAX)='CREATE PROCEDURE PascalsTriangle3 @Levels INT AS BEGIN SET NOCOUNT ON ~o |=2~ |~1 &~2 &~q NVARCHAR(2048)CREATE TABLE #o([1] &)INSERT #o VALUES(1) o:EXEC(''ALTER TABLE #o ADD[''+@o+'']&'')$|O #r ^#o ORDER BY 1 OFFSET(@o-2)ROWS FETCH NEXT 1 ROWS ONLY!1 = 1!2 = 1! = 2   i:!q = CONCAT(''~ TABLE (val &);UPDATE #r SET ['',@,'']=ISNULL(['',@,''], 0)+'',@1,''OUTPUT deleted.['',@,'']|O @;!t=($^@)'')EXEC sp_executesql @q,N''@t & OUTPUT'',@t=@2 OUTPUT!1 = @2!+=1IF @ <= @o GOTO i   INSERT #o$ ^#r!o += 1%#r IF @o <= @Levels goto o$ ^#o%#o END' SELECT @s=REPLACE(@s,LEFT(i,1),SUBSTRING(i,2,20)) FROM(VALUES('~ DECLARE @'),('! SET @'),('& DECIMAL(38,0)'),('% DROP TABLE '),('$ SELECT *'),('^ FROM '),('| INT'))a(i) EXEC(@s)