[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 329
  • Last Modified:

Working with CSV files in C#

I would like to import information from a CSV file into a SQL Server table.  The issue that I am dealing with is I don't want to use all the fields in the CSV, only a few.  I would like to pull columns with the following header names, namecol, addresscol, agecol.  There are a total of 10 columns in the CSV file, but I only want to pull the 3 that I mentioned, so what exactly do I do to pull only the 3?  I do not want to use the index parameter like [0], so what do I do?
0
VBBRett
Asked:
VBBRett
  • 2
1 Solution
 
dexterrajeshCommented:
hi,

you can use the Import / Export wizard in SQL enterprise manager to straight away import them into a table.
when you get to Select Source Tables and Views click on the button "Edit Mappings" on the bottom left of the screen. That opens column mappings screen; on the destination column select Ignore to remove the column you don't want to import.

hope this helps
0
 
VBBRettAuthor Commented:
I have to automate code with C#.  Sorry, this solution won't necessarily help because of the process involved.  How can I import specific column names using C#?
0
 
dexterrajeshCommented:
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now