Quantcast
Channel: Shailendra Saxena
Viewing all articles
Browse latest Browse all 18

Inserting multiple record in one insert statement

$
0
0
CREATETABLE [dbo].[employee]([empid] [varchar](10)NULL,[empname] [varchar](100)NULL,[salary] [int] NULL,[mgrid] [varchar]
)

There are following two ways.

1.
Insertinto employee select'E0001','RAM',25000,'E0002'Union all
select
'E0002','SHYAM',55000,'E0003'Union all
select
'E0003','RAMSHYAM',55000,''Union all
select


2.

Insertinto employee select'E0001','RAM',25000,'E0002'Insertinto employee select'E0002','SHYAM',55000,'E0003'Insertinto employee select'E0003','RAMSHYAM',55000,''Insertinto employee select'E0004','JOSHI',35000,'E0002'
'E0004','JOSHI',35000,'E0002'(10)NULLON [PRIMARY]

Viewing all articles
Browse latest Browse all 18

Trending Articles