I am using SQL Server 2008 R2. I am creating a table using
Select..
Into...
From
where the From
is actually 2 joined tables.
Will the resultant table have the indexes of the original tables?
marc_s
759k185 gold badges1.4k silver badges1.5k bronze badges
asked Jul 25, 2014 at 14:58
-
1No, you have to create them afterwards.timo.rieber– timo.rieber2014年07月25日 15:03:30 +00:00Commented Jul 25, 2014 at 15:03
1 Answer 1
Well, you could try this yourself and see. But the answer is no. It will have a table schema consisting of the columns and types in the Select clause, but no indexes, foreign keys or anything from the source table(s).
answered Jul 25, 2014 at 15:02
2 Comments
DeveloperM
Thanks, Randy. I created a non-clustered index after the fact.
Der U
it helps to right click objects in the object explorer of SSMS (if you use that) and the click "SCRIPT for..." and then choose "CREATE in". This can be done with tables, indexes and a lot more. Saves time but needs proper adjustment of names of new objects.
Explore related questions
See similar questions with these tags.
lang-sql