|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Friday, April 19, 2013 5:25 PM
Points: 217,
Visits: 76
|
|
/* 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
|
|
|
|