how to print star using sql

my sql printing pattern sql 4 years, 8 months ago
DECLARE @var int SELECT @var = 5 WHILE @var >0 BEGIN PRINT replicate('* ', @var) SET @var = @var - 1 END ** In simlar way you can print different patterns ** or you can query the atterns in the below way also SET @number = 0; SELECT REPEAT('* ', @number := @number+1) FROM information_schema.tables LIMIT 20;
940
Instructions

output:
*
* *
* * *
* * * *
* * * * *
* * * * * *

Posted By