Very Tough CSV Data Import to SQL 2005 DB Table Challenge
-
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
-
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
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
-
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
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