temporary table and indexes

  • honey_tnr

    Mr or Mrs. 500

    Points: 537

    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?

  • rajankjohn

    SSCertifiable

    Points: 5061

    No, it will not contain any indexes.

  • Ian Yates

    SSCoach

    Points: 19738

    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 3 (of 3 total)

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