Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


output behavior


output behavior

Author
Message
keycard
keycard
SSC Veteran
SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)SSC Veteran (238 reputation)

Group: General Forum Members
Points: 238 Visits: 140
/*
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search