---- to insert Data into ALL fields
INSERT INTO EMP1 VALUES(4,'Steve','USA',9000)
---- to insert Data into SPECIFIC fields
INSERT INTO EMP1(Name,Salary) VALUES('Jill',7000)
---- to insert Data into Table from another Table (both Tables Must Exist)
INSERT INTO EMP1
SELECT * FROM EMP
---- Create New Table and Insert Data from existing Table
SELECT * INTO myNewTable
FROM EMP
---- to insert Data into Multiple Rows
INSERT INTO EMP (ID, Name, Country, Salary)
SELECT 1, 'Vijay', 'India', 6000
UNION ALL
SELECT 2, 'Bill', 'USA', 8000
UNION ALL
SELECT 3, 'Kris', 'France', 3000
GO
---- Bulk Insert, inserting data from Text file to Table
Create a “data.txt” with following data and save at C:
ID, Name, Country;
1, Vijay,India;
2, Bill, USA;
then run the following query
BULK INSERT EMP
FROM 'c:\data.txt' WITH
(
FieldTerminator = ',',
RowTerminator = ';'
)