• ma-516002 (6/17/2010)


    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 @myothertab

    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

    returns 4 rows on SS2008 contrary to your explanation. why?

    There's an error in your sql above. You're inserting twice into the same table (@myothertab) and not at all into @myanothertab.