• Old Hand was a attentive reader and found the bug :w00t: in Ten Centuries code as follows.

    i must say a don't read the cod ereally because i got this constraint violation error many times in the past 😛

    declare @myothertab table (

    col2 varchar(20),

    col3 varchar(20)

    )

    insert into @myothertab

    select 'A','B' union all

    SELECT 'W','Q'

    ;

    declare @myanothertab table (

    col2 varchar(20),

    col3 varchar(20)

    )

    insert into @myanothertab /* < should be*/

    select 'A','B' union all

    SELECT 'W','Q';

    select 1 as col1, col2, col3 into #mytmp

    from @myothertab

    insert into #mytmp

    select null,col2,col3

    from @myanothertab

    select * from #mytmp