How do i read and import piple delimited files to the database. File has data which has line break.
I tried SQL Sever File Import wizzard as well as CSV Helper Library. Could you please help me how do I read the data successfully which has line break.
example,
unique_id|name|notes
123|John|Subject: Meet the new interns
Dear team,
I'm happy to inform you of the commencement of our summer internship program. We recruited 10 interns
456|Rit|Subject: Meet the new interns
Dear team,
I'm happy to inform you of the commencement of our summer internship program. We recruited 10 interns
Jignesh KumarPosted Mar 28, 2023, 4:25 AM
Hello Rana,
You can try below code,
Amit MohantyPosted Mar 28, 2023, 4:13 AM
You can use a library like CsvHelper to read the data from your CSV file into a list of strings.
Here's an example code:
Istudent RanaPosted Mar 27, 2023, 3:21 PM
@Pasang Tamang, I can not do that way as the last data has line break.
Pasang TamangPosted Mar 27, 2023, 3:05 PM
Hi,
You can read the file using FileStream and split the file content with '|'. Please check below code
Regards,
Pasang