declare @a int = ASCII('A') declare @b int = ASCII('F') declare @c int = 1 while(@a <= @b) begin print CHAR(@a) set @a = @a + 1 if(@a > @b) begin if(@c = 1) begin set @a = ASCII('a') set @b = ASCII('f') set @c = @c + 1 end else begin return end end end