import CSV file to a table in SQL Server
Posted on 2004-09-22
I need help with a situation that iam facing right now.
Here is the problem:
I have a tab limited or comma delimited CSV file. I want to read the contents of that CSV file and import it in one of the tables in the database using ASP.Net and VB.Net or C#.Net.
id firstname lastname
-- ---------- ----------
"1" "John" "Smith"
"2" "Louis" "Garcia"
I assume that the columns in the CSV files and the table in the database match the datatype.
What would be a good approach to do it ? If anyone have a code snippet that does the job, please post it.