Results 1 to 4 of 4

Thread: csv into sql table

  1. #1

    Thread Starter
    Fanatic Member drpcken's Avatar
    Join Date
    Apr 2004
    Location
    devenv
    Posts
    591

    csv into sql table

    I recently wrote an app that takes a tab delimted file in notepad, split the delimeter, and import it into a column in sql. Just one column.

    Now I have to do the same thing, only Its a excel sheet (csv) and it has about 17 column headers. I want to do the same thing, but I'm having trouble figuring out how to tell it which column in excel belongs to which column in sql. I've created a sql table with the exact column headers as the excel sheet, and want it to insert accordingly.

    I can post the code I used to get the single column data in from my last project. Any help would be great!

    Thank you and I hope this isnt' too confusing.

  2. #2
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263
    Is this MS SQL SERVER?

    If so, have you looked into the BULK INSERT command or the BCP command line utility?

  3. #3

    Thread Starter
    Fanatic Member drpcken's Avatar
    Join Date
    Apr 2004
    Location
    devenv
    Posts
    591
    Yes it is MS Sql server 2000.

    I don't think I've heard of the bulk insert command.

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    You could also create a DTS import package. You can easily transform
    your data and map fields too. Look in Enterprise Manager to
    create a package.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width