0

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
1
  • 1
    No, you have to create them afterwards. Commented Jul 25, 2014 at 15:03

1 Answer 1

3

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

Thanks, Randy. I created a non-clustered index after the fact.
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.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.