IF OBJECT_ID('Employee','U') IS NOT NULL
DROP TABLE Employee
Ceating the Emlployee table
CREATE TABLE Employee
(
NAME VARCHAR(20),
SALARY INT
)
I alredy created the txt file with folliwing path and data “E:\BulkInsert.txt”
rakesh,5000
madhu,6000
ali,7000
Run the script
BULK
INSERT Employee
FROM 'D:\BulkInsert.txt'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
(3 row(s) affected)
FIELDTERMINATOR:
In above text file each field is separated with (,) comma .
ROWTERMINATOR:
In above text file each row is teminated with (\n) new line charachter
SELECT * FROM Employee
.
Comments
Post a Comment