Multi Insert concept

Suppose if you want insert table some value and same value insert to another table then bellow Query is useful to you.

 

 

Multi Insert Concept

create table #abc
(
col1 int identity,
col2 varchar(10)
)

create table #bbb
(
col1 int,
col2 varchar(10)
)

insert #abc (col2)
output inserted.col1, inserted.col2 into #bbb
select ‘My Value’

select * from #abc
select * from #bbb

drop table #abc
drop table #bbb

Advertisements

Author: tdmsql

I am a PL-Sql Developer. I am searching some sites sql studies but its bored. i like create studies note my own way. so that i created this site.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s