I have to import an csv file to SQL database table which already created (empty and has the same number of named columns). It would be great if you could suggest any tutorials or give some tips.
Asked
Active
Viewed 1,866 times
0
-
Which database are you using and which version? SQL Server 2008? – John Saunders Feb 26 '11 at 04:23
1 Answers
1
I assume you are using Microsoft SQL Server. Do you need to do this in a program or manually? There is a tutorial on using the bcp
command for that, or alternatively a SQL command. If you need to parse the CSV file for your own code, see this previous SO question.

Community
- 1
- 1

Jeremiah Willcock
- 30,161
- 7
- 76
- 78
-
Thank you very much.Is there a different way to do this? My CSV file contains last column which is one of three words(insert,update or delete). According to this I need or insert CSV file to the datatable or update or delete records. And what is the best way to know what is the data("word") in this row in this column? Thank you in advance. – Tracy Feb 26 '11 at 15:42
-
@RedHelen: You might need to load the CSV file into your program and then have that update the database. Look at the last link in my answer for directions on how to do that. – Jeremiah Willcock Feb 26 '11 at 19:27