[sql-server] How to save select query results within temporary table?

I need to save select query output into temporary table. Then I need to make another select query against this temporary table. Does anybody know how to do it?

I need to make this on SQL Server.

This question is related to sql-server sql-server-2005

The answer is


In Sqlite:

CREATE TABLE T AS
SELECT * FROM ...;
-- Use temporary table `T`
DROP TABLE T;

select *
into #TempTable
from SomeTale

select *
from #TempTable