[dba-SQLServer] SELECT INTO Versus CREATE #temp

Arthur Fuller fuller.artful at gmail.com
Fri Jul 18 09:05:51 CDT 2008


I guess maybe I can only find out by writing a test case that inserts 1K or
10k rows. None of the instances of such code impose any constraints, so it
may be 6 of one and 1/2 dozen of the other. Maybe they both resolve to
identical code beneath the covers; maybe not. I'll write my test case and
report back with the results.

One other completely unrelated question: why is it that your messages (and
only yours) have about 100 blank lines between the end of the message and
the usual dba-SQL Server mailing list signature?

Thanks,
Arthur

On Fri, Jul 18, 2008 at 10:54 AM, Asger Blond <ab-mi at post3.tele.dk> wrote:

> With CREATE TABLE #tempTable you can specify constraints (and thereby
> unique
> indexes if you specify a primary key or unique constraint) in the
> create-table-statement.
>
> A table created with SELECT INTO doesn't inherit any constraints or indexes
> from the source table. But you can of course build these constraints and
> indexes on the destination table after it has been created.
>
> No other difference as far as I know.
>
> Asger



More information about the dba-SQLServer mailing list