• I tried to replicate this (in SQL Server 2008), and I didn't get a unique constraint violation, I got

    "An explicit value for the identity column in table '#fred' can only be specified when a column list is used and IDENTITY_INSERT is ON."... so my temp table was created with an identity column (despite the fact that all 10 rows in it had the same value from the select into!).

    My (anonymised - I did use real integer ID and text value tables) code. Did I miss something?:

    SELECT 1 AS col1, st.IDColumn, st.TextColumn

    INTO #fred

    FROM SomeTable st

    INSERT INTO #fred

    SELECT NULL, sot.IDColumn, sot.TextColumn

    FROM SomeOtherTable sot

    and the results:

    (10 row(s) affected)

    Msg 8101, Level 16, State 1, Line 5

    An explicit value for the identity column in table '#fred' can only be specified when a column list is used and IDENTITY_INSERT is ON.