I create a Virtual table (Fictional)
SELECT TOP 1 ItemID
INTO #Temp
FROM PS_GameData.dbo.CharItems
WHERE ItemID = 1001
INSERT INTO #temp VALUES((SELECT ItemID FROM #Temp));
SELECT ItemID
FROM #Temp
DROP Table #Temp
How do I separate this query that goes on the same sql sheet? so that it does not say to me in the query .sql exists the table #temp IMPORTANT are 65000 Queries I need to do them all in the same extension file .SQL
SELECT TOP 1 ItemID
INTO #Temp
FROM PS_GameData.dbo.CharItems
WHERE ItemID = 1002
INSERT INTO #temp VALUES((SELECT ItemID FROM #Temp));
SELECT ItemID
FROM #Temp
DROP Table #Temp
OK Please try this in a Same SQL Sheet and correct error without removing the SQL query
SELECT TOP 1 ItemID
INTO #Temp
FROM PS_GameData.dbo.CharItems
WHERE ItemID = 1001
INSERT INTO #temp VALUES((SELECT ItemID FROM #Temp));
SELECT ItemID
FROM #Temp
DROP Table #Temp;
-- Termina Consulta
SELECT TOP 1 ItemID
INTO #Temp
FROM PS_GameData.dbo.CharItems
WHERE ItemID = 1002
INSERT INTO #temp VALUES((SELECT ItemID FROM #Temp));
SELECT ItemID
FROM #Temp
DROP Table #Temp;
Error:
Msg 2714, Level 16, State 1, Line 13 There is already an object named '#Temp' in the database.
PS: it does not cost much to execute this query