mssql create temp table Edit
Creating a temporary table in mssql is one of the easiest things to do. You can use the same syntax as creating a table, the only difference prepend a # to the table name. A temp table will exist in the database only temporarily. Temp table is stored in tempdb which is a system database.
create table #RecipeIngredients ( [IngredientName] [nvarchar](128) NULL, [Quantity] [nvarchar](64) NULL, [UnitName] [nvarchar](64) NULL )
If I already have a table say SetupCountry with properties NumericId & Name, I can use the select into statement to create the table
select Name,NumericId into #TempCountry from SetupCountry select * from #TempCountry
The above query will return the list of countries from the temporary table