How to draw triangles in SQL Server as shown below?

I want to implement it by using WHILE loops, but I am unable to print 20 '*' in a single line in SQL Server.
How can I achieve this?
Use REPLICATE inside a WHILE. I think, you can achieve your desired output if you do it correctly?
DECLARE @i INT = 20
WHILE(@i>0)
BEGIN
PRINT REPLICATE('* ', @i);
SET @i = @i - 1;
END
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With