Mathew,
So this allows you to query the CSV directly? Would this method work for
importing data into an existing table by looping over the resulting query
and doing the insert? Can you then delete the file and the connection?
If the csv file contained field names in the first row, is this what you
get back as columns?
Brook
At 04:33 PM 10/29/02 +1300, you wrote:
>This is how we've been doing it:
>
><cfset ConnectString = "Driver={Microsoft Text Driver (*.txt;
>*.csv)};Dbq=#fulldirectorypath#;Extensions=txt,csv;Persist Security
>Info=False;">
>
><CFQUERY NAME="Log" DBType="dynamic" ConnectString="#ConnectString#">
> SELECT *
> FROM [#file#]
> ORDER BY myColumn
></CFQUERY>
>
>fulldirectorypath is the directory not the file. file is the filename
>excluding the extension.
>
>Matthew Walker
>http://www.matthewwalker.net.nz/
>
>
>
>
> > -----Original Message-----
> > From: Michael Kear [mailto:mkear@;afpwebworks.com]
> > Sent: Tuesday, 29 October 2002 4:22 p.m.
> > To: CF-Talk
> > Subject: DSN-less connection to a CSV file?
> >
> >
> > I have an information provider FTP'ing a series of .csv files
> > into my server
> > every night, and I need to use these files to create dynamic
> > tables for
> > users. Since they are updated every day, I can't have them
> > locked and in
> > use when the provider's automatic ftp dumps them into my site.
> >
> > So what I wanted to do was set my calculator up so that when
> > my site user
> > calls the information, the page connects to the .csv table,
> > does the query
> > then disconnects again.
> >
> > Is this (a) possible? (b) the best way to access (only read
> > - not write or
> > update) the .csv files so that they are not locked when the
> > ftp program
> > comes to drop new ones on the server? If so, can someone
> > please give me
> > the code to connect to the .csv file?
> >
> > (we're using CF5) There's no documentation at all about
> > dsnless connection
> > in the docs, and I haven't been able to find any thing in the
> > archives of
> > this list or any other.
> >
> >
> > Cheers,
> > Mike Kear
> > Windsor, NSW, Australia
> > AFP WebWorks
> >
> >
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com