temporary table and indexes

  • if you create a temporary table using select into statement from base table, will all the indexes present in the base table transfer to the temporary table?

  • No, it will not contain any indexes.

  • select into is a shorthand convenience to both create and populate a table at once without having to explicitly do a CREATE TABLE statement.

    It even allows you to, on the fly, create a table from a query that could be joining several tables, or is just a query that involves no table at all... Thus it can only use the data types of the columns to create the table. No primary keys, etc are defined for you.

    If it's a table which you need to perform well, you should create it explicitly so that the data types are properly defined and then populate it using the standard "insert into".

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply