If the file is in a web accessible folder, you can use <cfhttp to read
it into a query. Then loop over the query to update the database.

<cfhttp url=""
        name="qCSV" columns="header_id,track_nbr"
        textqualifier="""" delimiter=","
        resolveurl="no" throwonerror="yes"
        timeout="20" charset="iso-8859-1"></cfhttp>
<cfloop query="qCSV">
UPDATE table
SET track_nbr = <cfqueryparam cfsqltype="cf_sql_varchar"
value="#qCSV.track_nbr#">
WHERE header_id = <cfqueryparam cfsqltype="cf_sql_numeric"
value="#qCSV.header_id#">
</cfloop>

Pascal

> -----Original Message-----
> From: Ciliotta, Mario [mailto:[EMAIL PROTECTED]
> Sent: 13 September 2004 23:36
> To: CF-Talk
> Subject: Question about processing a CSV file.
>
>
> Hi,
>
> I was wondering if anyone could help me out as I am stuck on this
part.  I
> have a csv file that I would like to read and then issue an update
query
> based
> on the contents.
>
> Basically I would like to read the file and then loop over the file
and
> issue
> and update query for each line (maybe I could convert it to stored
> procedure
> later).
>
> And what I want to do is loop over it and issue an update:
> PUSEDOCODE:
>
> <CFLOOP over the file>
>     update table
>         set track_nbr = '2345678il'
>     where header_id = 5388120
> </cfloop>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to