Re: Importing from CSV to a database

2010-10-22 Thread Will Tomlinson
Thanks, but it is not that simple. I have plenty of things to check, convert, validate, etc. Don't forget an Excel file is created and filled by humans ;-) I would figure out a way to use my RDBMS to handle this. Navicat or SQL Server tools to do it. Then clean the data or whatever once it's

Re: Importing from CSV to a database

2010-10-22 Thread M P
I agree using something like Navicat to load the data would be a much better solution, but if you must use code, then I would parse those table names and replace all of the bad characters and spaces before creating the tables. Special characters and spaces just cause too many problems to even

Re: Importing from CSV to a database

2010-10-21 Thread Ketan Jetty
Another way to do this is read the file, loop thru the lines and massage the data as wanted when inserting into the database. This way you can have better control on the data manipulation. cfloop file=#expandPath('.')#\sampledata.csv from=1 index=line cfquery name=qi datasource=#mydsn#

Re: Importing from CSV to a database

2010-10-21 Thread Casey Dougall
On Thu, Oct 21, 2010 at 1:03 PM, Ketan Jetty kje...@yahoo.com wrote: Another way to do this is read the file, loop thru the lines and massage the data as wanted when inserting into the database. This way you can have better control on the data manipulation. cfloop

Re: Importing from CSV to a database

2010-10-21 Thread Claude Schnéegans
If this is MS SQL you can do this as well. Thanks, but it is not that simple. I have plenty of things to check, convert, validate, etc. Don't forget an Excel file is created and filled by humans ;-) ~| Order the Adobe

Importing from CSV to a database

2010-10-20 Thread Claude Schnéegans
Hi, I have to create a new database from a CSV text file. I have an ODBC datasource defined for the CSV file and I can read the file with a query like: CFQUERY NAME=getMembers DATASOURCE=Import SELECT * FROM membersImport.csv /CFQUERY The problem is that column names have blanks and special

Re: Importing from CSV to a database

2010-10-20 Thread Leigh
I've tried getMembers['Région administrative'] but it causes an error. Did you forget the row number or is that typo? ie queryName[column name][ rowNumber ] ~| Order the Adobe Coldfusion Anthology now!

Re: Importing from CSV to a database

2010-10-20 Thread Claude Schnéegans
Did you forget the row number or is that typo? Actually, I'm in a loop on the query, I thought the row number would be implicit as usual. But you're right, queryName[column name][queryName.currentRow] does work. This is kind of weird since queryName.columnName works, bur not

Re: Importing from CSV to a database

2010-10-20 Thread Leigh
This is kind of weird since queryName.columnName works, bur not queryName[columnName] I guess the difference is queryName[columnName] gives you access to the column array. I thought it was strange at first too. But realized it is a good thing, since it allows you to access values in any row