Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Very Tough CSV Data Import to SQL 2005 DB Table Challenge

Very Tough CSV Data Import to SQL 2005 DB Table Challenge

Scheduled Pinned Locked Moved Database
databasehelpdata-structurestutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dsabjp
    wrote on last edited by
    #1

    I have a comma delimited text file with array type columns (number of columns may vary) to import into SQL 2005 DB Table. Need help please! I was hoping to attach a safe (no vb or macro) Excel workbook that does a good displaying background data (picture), CSV file format and final SQL 2005 DB Table format as well. I can e-mail if someone has the time to review and provide some useful advice on how to handle my "array" type problem. Thanks... Dean Pugh

    M 1 Reply Last reply
    0
    • D dsabjp

      I have a comma delimited text file with array type columns (number of columns may vary) to import into SQL 2005 DB Table. Need help please! I was hoping to attach a safe (no vb or macro) Excel workbook that does a good displaying background data (picture), CSV file format and final SQL 2005 DB Table format as well. I can e-mail if someone has the time to review and provide some useful advice on how to handle my "array" type problem. Thanks... Dean Pugh

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      Does the column count vary per CSV file or are the number of columns different per row. 1 Read the title row, create a table based on the titles 2 Read the entire file create a table with the max columns This article [^]may help with the techniques

      Never underestimate the power of human stupidity RAH

      D 1 Reply Last reply
      0
      • M Mycroft Holmes

        Does the column count vary per CSV file or are the number of columns different per row. 1 Read the title row, create a table based on the titles 2 Read the entire file create a table with the max columns This article [^]may help with the techniques

        Never underestimate the power of human stupidity RAH

        D Offline
        D Offline
        dsabjp
        wrote on last edited by
        #3

        Good ideas. I seem to have found an option that works pretty good. Using OPENROWSET my import works okay as long as the table has equal to or more columns than the csv file. In answer to your question, it is possible that different rows have different number of fields. So far in the examples I've played with Openrowset allows records to be added and any missing columns are taken off from the last columns. I can live with that since I can delete the rows later if needed. Now for the few records that were possibly causing the whole import to crash, I now get the whole import and can do a search and delete rows afterwards. Sorry for the delayed response. I've just got back to my computer. Many thanks for your ideas Mycroft, I would try them next. :) Dean

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups