1-- generate a guid table
2;with guids( i, guid ) as
3(
4 select 1 as i, newid()
5 union all
6 select i + 1, newid()
7 from guids
8 where i < 20
9)
10
11-- print triangle
12select replicate('* ', i)
13from guids
14order by i asc
15option (maxrecursion 30)
16
17-- print triangle inverted manner
18select replicate('* ', i)
19from guids
20order by i desc