• Phil Parkin (9/29/2014)


    antonela (9/29/2014)


    I wanted to avoid 'insert into #table select * from table'... and only use 'select * into #table from table' simply because is too fast...

    But I think that I'll use the first one (with the second one I have the error that the table already exists in database even if I put a conditional split for the parameter).

    If this is production-quality code that you are writing, you should be avoiding SELECT ... INTO completely, in my opinion. You may run into problems with IDENTITY columns if you do not.

    Instead, create the temp table with exactly the layout you require and then INSERT to it, using explicitly named column lists. NOT SELECT *.

    I couldn't agree more. Only grab the columns you really need and skip the rest.