SQL SERVER||4 Ways to Insert Multiple rows in single statement

SQL SERVER||4 Ways to Insert Multiple rows in single statement

LearnSQLtoSSIS

1 год назад

232 Просмотров

How to insert multiple records into a table with single insert statement in SQL?

There are 4 ways to insert multiple records into a table

First Method:
INSERT INTO EMP_TBL VALUES(1,'Raju','HR')

Second Method:
INSERT INTO EMP_TBL (ID,ENAME,DEPT_NAME)
VALUES(1,'Raju','HR'),
(2,'Karim','IT'),
(3,'Satya','Admin')

THIRD Method:
INSERT INTO EMP_TBL (ID,ENAME,DEPT_NAME)
SELECT 1,'Raju','HR'
UNION ALL
SELECT 2,'Karim','IT'
UNION ALL
SELECT 3,'Satya','Admin'

Fourth Method:
INSERT INTO EMP_TBL (ID,ENAME,DEPT_NAME)VALUES(1,'Raju','HR')

Тэги:

#Insert #values #table #columnnames #unionall #into
Ссылки и html тэги не поддерживаются


Комментарии:

@RaviKumar-ub6vy
@RaviKumar-ub6vy - 04.12.2022 12:29

Hi Bro..Max every day you are posting videos.. Last 5 days you are not posting. Pls post regularly. It's very informative. Thanks .

Ответить