• + 0 comments

    DECLARE @N INT = 1000; DECLARE @i INT = 2;DECLARE @output NVARCHAR(MAX) = '';
    WHILE @i <= @N BEGIN IF (@i % 2 = 0) BEGIN SET @output = @output + CAST(@i AS NVARCHAR) + '&'; END SET @i = @i + 1; END SET @output = LEFT(@output, LEN(@output) - 1); PRINT @output; What is the problem in my this code?