• I think using a table variable instead of a temp table will help you:

    DECLARE @t1 TABLE( c1 int, c2 varchar(10) )

    now @t1 is a local table variable. Memory for it is allocated as long as the variable is in scope. The only disadvantage is that it consumes memory. Of course, it is much faster then a temp table (in tempdb).

    I do not think you can alter a table variable, create indexes on it, etc. But you can include constraints in the DECLARE statement.

    Edited by - mromm on 05/02/2003 6:32:42 PM