Some fun with TSQL

As a bit of fun, the following code was run in SSMS with:

  • Results to Text
  • ‘Include column headers in the result set’ unticked
SET NOCOUNT ON
DECLARE @i int;
SET @i = 1;
WHILE (@i < 20)
BEGIN
SELECT '                     '
SET @i = @i +1
END
SELECT '          *          '
SELECT '         ***         '
SELECT '        *****        '
SET @i = 1;
WHILE (@i < 20)
BEGIN
SELECT '                     '
SET @i = @i +1
END

akawn

Leave a Reply