Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

temporary table and indexes Expand / Collapse
Author
Message
Posted Sunday, January 27, 2008 9:44 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, February 11, 2011 1:42 PM
Points: 323, Visits: 42
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?
Post #448127
Posted Sunday, January 27, 2008 10:45 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, April 15, 2014 10:36 AM
Points: 1,199, Visits: 574
No, it will not contain any indexes.
Post #448131
Posted Monday, January 28, 2008 1:08 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, January 30, 2014 10:08 PM
Points: 1,038, Visits: 444
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".



Post #448145
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse