My csv selection tool is powershell, as it has a built-in import-csv command. This is a fantastic glue for this kind of thing.
Here's a link in which the developer imports csv and converts it into an insert script. http://allen-mack.blogspot.com/2008/02/powershell-convert-csv-to-sql-insert.html
Running the script from a link (note: powershell gives you tab completion so you can use it to help with file paths during input):
- Create a file called Import-File.ps1 and copy the contents of the script from the link into it.
- Run powershell
- Enter "set-executionpolicy remotesigned" (note: this weakens the security of your system only a little, but the default settings will not allow you to run any scripts)
- Go to the directory with your script and import the file
- Enter '. \ Import-file.ps1. \ Importfile.csv'
- Press Enter; voila, you must have a nested sql script in the same directoy (i.e., importfile.sql) in our case)
Finally, since you can create .net objects from within powershell, you can modify the script and do a few things, such as inserting data directly into the database.
source share