Home Forums SQL Server 2008 T-SQL (SS2K8) how to use temp tables or other less resources in store proc RE: how to use temp tables or other less resources in store proc

  • You can select data into temp tables like this:

    select *

    into #TempTable

    from dbo.table

    Temp tables starting with one # exist for the session, or until you drop them. If you create them in a stored procedure, the temp tables will be dropped when it finishes.

    You can drop them yourself like this:

    drop table #TempTable

    A simple solution might be to just drop the unwanted tables at the end of the stored procedure.