DECLARE	@sqr INT,
		@i INT,
		@door INT;

SELECT @sqr =1,
	@i = 3,
	@door = 1;	

WHILE(@door <=100)
BEGIN
	IF(@door = @sqr)
	BEGIN
		PRINT 'Door ' + RTRIM(CAST(@door AS CHAR)) + ' is open.';
		SET @sqr= @sqr+@i;
		SET @i=@i+2;
	END
	ELSE
	BEGIN
		PRINT 'Door ' + RTRIM(CONVERT(CHAR,@door)) + ' is closed.';
	END
SET @door = @door + 1
END