joepeacock
Programmer
Hello all,
Here's my problem: I administer a website where users upload csv files and they are incorporated into a database. Of course, it's impossible to get all of the users to arrange their files correctly, so the files coming in may have any number of columns, with or without headers, with columns in any order. I currently analyze the files using Cold Fusion, identify relevant columns and do a line-by-line insert into a table on the SQL Server database, then compare that table to the main data tables to update the information appropriately. The problem with that is that some of the files uploaded have 100,000+ records, meaning the line-by-line insert can be slow.
What I'd like to do is just import the file into a new table, identify the relevant columns once it is imported, do a single query to copy the information into an existing table, and drop the new table. Of course, this is all automated, so I'd like to create a DTS package to do all of that.
The difficulty I'm having is that I can't seem to find a way to just import a file into a new table and have the file determine the table format. I either have to import to an existing table, or create a properly formatted table and then import. That won't work, since each file may have a unique format.
Is there a solution to this?
Thanks,
Joe
Here's my problem: I administer a website where users upload csv files and they are incorporated into a database. Of course, it's impossible to get all of the users to arrange their files correctly, so the files coming in may have any number of columns, with or without headers, with columns in any order. I currently analyze the files using Cold Fusion, identify relevant columns and do a line-by-line insert into a table on the SQL Server database, then compare that table to the main data tables to update the information appropriately. The problem with that is that some of the files uploaded have 100,000+ records, meaning the line-by-line insert can be slow.
What I'd like to do is just import the file into a new table, identify the relevant columns once it is imported, do a single query to copy the information into an existing table, and drop the new table. Of course, this is all automated, so I'd like to create a DTS package to do all of that.
The difficulty I'm having is that I can't seem to find a way to just import a file into a new table and have the file determine the table format. I either have to import to an existing table, or create a properly formatted table and then import. That won't work, since each file may have a unique format.
Is there a solution to this?
Thanks,
Joe