Inserting data into a temporary table Inserting data into a temporary table sql sql

Inserting data into a temporary table


INSERT INTO #TempTable (ID, Date, Name) SELECT id, date, name FROM physical_table


To insert all data from all columns, just use this:

SELECT * INTO #TempTableFROM OriginalTable

Don't forget to DROP the temporary table after you have finished with it and before you try creating it again:

DROP TABLE #TempTable


SELECT  ID , Date , Name into #temp from [TableName]