I am trying to insert select query result into a temporary table inside the while loop. But below query gives me this error:
There is already an object named '#TT' in the database.
DECLARE @V_START INT = 1;
DROP TABLE #TT
WHILE(@V_START < 4)
BEGIN
SELECT * INTO #TT
FROM Table
WHERE Column = @V_START;
SET @V_START = @V_START + 10;
END
SELECT * FROM #TT