output behavior

  • /*

    I'm had a question on the behavior of OUTPUT statement (I would assume this applies to DELETE myTblA OUTPUT INTO myTblB and INSERT myTblA OUTPUT INTO myTblB as well).

    Below is my script:

    */

    -- begin testing output statement

    if object_id('tempdb.dbo.#tA','u') is not null drop table #tA

    if object_id('tempdb.dbo.#tB','u') is not null drop table #tB

    create table #tB

    (

    id int identity( 1, 1 )--,

    --f1 char(1)

    )

    select id = identity(int,5,1)

    into #tA

    --insert #tB (f1)

    --select 'a'

    select * from #tA

    delete #tA

    output deleted.id--, 'b'

    into #tB (id)--, f1)

    select * from #tA

    select * from #tB

    -- end testing output statement

    /* begin questions

    1. Does OUTPUT set identity_insert #tB on automatically for a table with Identity column?

    */ end questions

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply