Sort by

recency

|

1196 Discussions

|

  • + 0 comments

    Declare @vik int = 20 while @vik >= 1 Begin Print Replicate ('* ', @vik) Set @vik = @vik - 1 End

  • + 0 comments

    WITH RECURSIVE series AS ( SELECT 1 AS number -- Starting value UNION ALL SELECT number + 1 FROM series WHERE number < 20 -- Ending value )

    SELECT REPEAT('* ', number) FROM series ORDER BY number DESC;

  • + 0 comments

    SET @NUMBER = 21; SELECT REPEAT('* ', @NUMBER := @NUMBER - 1) FROM information_schema.tables WHERE @NUMBER > 1;

  • + 0 comments

    ORACLE SQL

    SELECT RPAD('* ', ((20*2)+1) - LEVEL*2, '* ') AS stars FROM dual CONNECT BY LEVEL <= 20;

  • + 0 comments

    I wrote the below in sql server to solve this. The output is as expected but i still get some 'run time error'. i wonder why!!

    create procedure triangle as declare @i int declare @j int

    set @i=1 set @j=20

    while @j>=@i begin print replicate ('*', @j) set @j=@j-1 end

    execute triangle