RE: Looping through a CSV File

2002-03-21 Thread Carlisle, Eric

Read the contents of the file into a variable.  Then use something like
this.









INSERT INTO myTable (column1, column2, column3)
VALUES
('#listGetAt(cvsfile,1)#','#listGetAt(cvsfile,2)#','#listGetAt(cvsfile,3)#')





You will probably want to add more code for error protection/correction.
That's how I would do it, though. :)

Good luck!

EC


-Original Message-
From: Jason Larson [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 21, 2002 11:14 AM
To: CF-Talk
Subject: Looping through a CSV File


I have a CSV File that I am pushing up using cffile. I want to loop
through the csv file and insert the content into a database, and I am
not sure how to do this. Any help our guidance would help?

Thanks
Jason



__
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Looping through a CSV File

2002-03-21 Thread Jason Larson

The structure will always be the same but the file name is going to
change though. I am backing up the old file before I push the new file
up.

Thanks,
Jason Larson
 

-Original Message-
From: Marlon Moyer [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, March 21, 2002 9:35 AM
To: CF-Talk
Subject: Re: Looping through a CSV File

If the csv structure will always be the same, you could set up an ODBC
connection and treat it like a table.


- Original Message -
From: "Mike Townend" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, March 21, 2002 10:26 AM
Subject: RE: Looping through a CSV File


> Treat the file as a list of lists...
>
> List 1 - Delimiter = #Chr(10)##Chr(13)#
>
> And each element of that list is a list with delimeter ,
>
> HTH
>
>
>
> -Original Message-
> From: Jason Larson [mailto:[EMAIL PROTECTED]]
> Sent: 21 March 2002 16:14
> To: CF-Talk
> Subject: Looping through a CSV File
>
>
> I have a CSV File that I am pushing up using cffile. I want to loop
> through the csv file and insert the content into a database, and I am
> not sure how to do this. Any help our guidance would help?
>
> Thanks
> Jason
>
>
>
> 

__
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: Looping through a CSV File

2002-03-21 Thread Zac Spitzer

Mike Townend wrote:

>Or theres a custom cfx tag called something like ... Cfxcsvtoquery that
>will take a csv file and convert it into a query variable
>
there are mercant text database drivers installed with cf, then u can do 
it via ODBC

select * from c:\data\file.csv

z


__
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: Looping through a CSV File

2002-03-21 Thread Marlon Moyer

If the csv structure will always be the same, you could set up an ODBC
connection and treat it like a table.


- Original Message -
From: "Mike Townend" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, March 21, 2002 10:26 AM
Subject: RE: Looping through a CSV File


> Treat the file as a list of lists...
>
> List 1 - Delimiter = #Chr(10)##Chr(13)#
>
> And each element of that list is a list with delimeter ,
>
> HTH
>
>
>
> -Original Message-
> From: Jason Larson [mailto:[EMAIL PROTECTED]]
> Sent: 21 March 2002 16:14
> To: CF-Talk
> Subject: Looping through a CSV File
>
>
> I have a CSV File that I am pushing up using cffile. I want to loop
> through the csv file and insert the content into a database, and I am
> not sure how to do this. Any help our guidance would help?
>
> Thanks
> Jason
>
>
>
> 
__
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Looping through a CSV File

2002-03-21 Thread Mike Townend

Or theres a custom cfx tag called something like ... Cfxcsvtoquery that
will take a csv file and convert it into a query variable

HTH



-Original Message-
From: Jason Larson [mailto:[EMAIL PROTECTED]] 
Sent: 21 March 2002 16:14
To: CF-Talk
Subject: Looping through a CSV File


I have a CSV File that I am pushing up using cffile. I want to loop
through the csv file and insert the content into a database, and I am
not sure how to do this. Any help our guidance would help?

Thanks
Jason



__
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Looping through a CSV File

2002-03-21 Thread Mike Townend

Treat the file as a list of lists...

List 1 - Delimiter = #Chr(10)##Chr(13)#

And each element of that list is a list with delimeter ,

HTH



-Original Message-
From: Jason Larson [mailto:[EMAIL PROTECTED]] 
Sent: 21 March 2002 16:14
To: CF-Talk
Subject: Looping through a CSV File


I have a CSV File that I am pushing up using cffile. I want to loop
through the csv file and insert the content into a database, and I am
not sure how to do this. Any help our guidance would help?

Thanks
Jason



__
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists