This is how you can use SQL Temp Tables for doing some operations that might require a temporary table. A temporary table can be useful if you just want to have a data store of values you just require temporarily and not permanently sitting as a dedicated SQL table.
In this example, I am creating a temporary SQL table called tb1 with one column of type integer that will hold values from 0 to 10. This can be handy if you want to compare values either returned from a SQL Function or SQL Stored Procedures. You can also use temporary table to derive some values without actually changing the values in a SQL Table.
DROP TABLE #tempo1 CREATE TABLE #temp01(ID int) DECLARE @i AS int SET @i = 0 WHILE (@i < 10) BEGIN INSERT INTO #temp01 VALUES(@i) SET @i += 1 END SELECT * FROM #temp01