It needs the data should be delimeted by specific delimeter.
The syntax is,
BULK INSERT TABLENAME
FROM SOURCE FILE
WITH (OPTIONS)
Now, I will create a temporary table to insert the records into the table.
create table testing
(
empname varchar(20),
value1 varchar(10)
)
Am having a text file with comma seperated delimeter and /n for the next line.

Now, am going to insert the data into the temporary table. Below is the bulk insert
syntax to insert the records into the table.
BULK INSERT testing
FROM 'C:\VP Personal\aa.txt'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
On selecting the table, we will get the records inserted into the table.
select * from testing

Thanks and Regards,
Venkatesan Prabu .J
No comments:
Post a Comment