I am trying to read a CSV file inside a Stored Procedure.
I have a temporary table and using the below query..
BULK INSERT #tmp FROM 'd:\temp\OBin3200.csv' WITH
(FIELDTERMINATOR = ',', ROWTERMINATOR = '\n')
select * from #tmp
drop table #tmp
but it seems that if the CSV file has a header it gives an error.
Compromised on that I remove the header and tried and it works. but there is
one more thing that I cannot avoid that the CSV file has all the values enclosed in "(double quotes) and the value inserted in the table is with the double quotes.
eg:- if the file format is like
"2001","12","some text","","desc"
the table will have
"2001","12","some text","","desc"
how to avoid enclose character?
and is there any way to read the CSV file with the header?
please advice..
sajid