Working with CSV files in C#

Posted on 2011-10-12
Last Modified: 2012-05-12
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?
Question by:VBBRett
    LVL 9

    Expert Comment


    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

    Author Comment

    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#?
    LVL 9

    Accepted Solution


    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Article by: Ivo
    Anonymous Types in C# by Ivo Stoykov Anonymous Types are useful when  we do not need to follow usual work-flow -- creating object of some type, assign some read-only values and then doing something with them. Instead we can encapsulate this read…
    Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now