locked
How to copy data from CSV to Table RRS feed

  • Question

  • I'm following the example here:

    http://www.dotnettwitter.com/2012/02/bulk-import-insert-and-update-using.html

    So, I created the Table, I have all the data in the CSV, I have the reference to the CSV set correctly, and then I run the SProc, and I get a message that says 'Command(s) completed successfully.'  Then, I go look at the Table and there is no data there.  It's kind of misleading, b/c the SProc runs and the message suggests that everything ran to completion, but in fact, nothing ran at all.  Very bizarre.  Can someone please tell me what I'm doing wrong?


    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

    Friday, September 13, 2013 1:53 AM

Answers

  • you can do it with Import/Export wizard in SQL Server, or with SSIS packages with a simple data flow.

    with these two methods you will have more control on the data transfer process rather using Bulk Insert command


    Regards,

    Reza

    SQL Server MVP

    Blog:   http://rad.pasfu.com  Twitter:   LinkedIn:

    SQL Server Integration Services 2012 Tutorial Videos:     http://www.radacad.com/CoursePlan.aspx?course=1

    • Proposed as answer by Kalman Toth Friday, September 13, 2013 2:15 AM
    • Marked as answer by Allen Li - MSFT Sunday, September 22, 2013 1:28 PM
    Friday, September 13, 2013 2:09 AM

All replies

  • you can do it with Import/Export wizard in SQL Server, or with SSIS packages with a simple data flow.

    with these two methods you will have more control on the data transfer process rather using Bulk Insert command


    Regards,

    Reza

    SQL Server MVP

    Blog:   http://rad.pasfu.com  Twitter:   LinkedIn:

    SQL Server Integration Services 2012 Tutorial Videos:     http://www.radacad.com/CoursePlan.aspx?course=1

    • Proposed as answer by Kalman Toth Friday, September 13, 2013 2:15 AM
    • Marked as answer by Allen Li - MSFT Sunday, September 22, 2013 1:28 PM
    Friday, September 13, 2013 2:09 AM
  • it is me be because of some NULL or special character which have been separated  value in starting Row or column...Please re-look the file and import again.

    if you want to go via Wizard please follow the link and use as test import in test table.

    http://stackoverflow.com/questions/6464601/how-to-validate-a-csv-file-before-importing-into-the-database-using-ssis


    EA


    Friday, September 13, 2013 2:51 AM
  • Yes, yes, yes, SSIS is the way to go with something like this.  I was trying to improve my SQL skills.  Maybe over the weekend I'll try to do this project using SSIS.  That's pretty easy.  What I'm really trying to do though, is use pure SQL to get the job done.  However, I recognize the benefit of using the right tool for the job.  A hammer should pound a nail, a saw should cut wood, etc.

    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

    Friday, September 13, 2013 3:31 AM