Written By:- Isha Malhotra
Our Website:-Tech Altum
Our Website:-Tech Altum
For Asp.net Training with C# and Sql Server Click Here
Different
Ways to Use Insert Command in SQL SERVER
Insert command is used to insert data into database. There are
many ways to insert data using insert command and these are following:-
Take table employee having two columns Emp_id and Emp_name
Simple Inserting command
1.
insert into Employee values('3','priya');
2.
insert Employee values('6','isha');
Insert command using column name which specifies in which column we
are going to insert the data.
3.
insert into employee(emp_id,emp_name) values('10','sapna');
4.
insert employee(emp_id,emp_name) values('11','sapna');
Insert command in which we select records from another table.
5.
insert employee1 select *
from Employee;
6.
insert into employee1 select *
from Employee;
Insert multiple records in
single insert command
7.
insert into employee(emp_id,emp_name)
select 12,'neha'
union all
select 13,'saloni';
8. insert into employee(emp_id,emp_name) values
(14,'rahul'),
(15,'avinash'),
(16,'abhinav');
No comments:
Post a Comment