Here's what I do, start to finish:

1) provide a file upload form

2) upload the file to the file system via CF.  Be sure to put it in the
folder that you specified in the DTS pkg you created, also making sure that
the file is named the same as the file you specified in the DTS pkg.

3) run the DTS via a stored procedure - a complete tutorial on hoew to do
that with CF can be found here:
http://www.pengoworks.com/index.cfm?action=articles:spExecuteDTS  (thanks
Dan)

4) delete the file, or archive it, or whatever.

That's about all there to it.  The hardest part is setting up the SP call
from CF, and that is pretty easy too, thanks to the handy-dandy tutorial.

Let me know if I left anything out.

On 8/27/07, Steve Sequenzia <[EMAIL PROTECTED]> wrote:
>
> I actually used SQL to do it because I was having issues with the CFM
> code. I still need to come up with a way for end users to do it from a web
> page. I need to look into it some more.
>
>
>
> > Why not use dts?  Put the work on the db server, not the cf server.
> > MUCH faster too.
> >
> > -----Original Message-----
> > From: "Steve Sequenzia" <[EMAIL PROTECTED]>
> > To: "CF-Talk" <[email protected]>
> > Sent: 8/24/07 2:32 PM
> > Subject: Importing CSV into
> >
> > I am trying to write some code that takes a .csv file and inserts it
> > into SQL.
> >
> > I am having issues with it reading the header. I would like to be able
> > to leave the header on the file and not have it insert the header data
> > into the DB.
> >
> > When I try to run it without a header I am having issues with it
> > reading the number of elements wrong. It is getting confused when a
> > line has blank data for the element.
> >
> > So it see following line as only having 8 elements when it should have
> > 13:
> >
> ,
> > Zachary,Abbott,D.O.,,1720 Northbrook Drive,,Ann Arbor,MI,48103,
> > [EMAIL PROTECTED],,
> >
> > Here is my code:
> >
> > <cffile action="read" file="#file1#" variable="fileData">
> >
> > <cfloop list="#fileData#" delimiters="#Chr(10)##Chr(13)#"
> > index="record">
> >
> > <cfquery name="qryInsert" datasource="physleads">
> >
> > INSERT INTO contacts (prefix, firstName, lastName, suffix, companyName,
> > address, address2, city, state, zipCode, phone, fax, email)
> > values (
>
> > #listgetat('#record#',1, ',')#'
>
> > #listgetat('#record#',2, ',')#'
>
> > #listgetat('#record#',3, ',')#'
>
> > #listgetat('#record#',4, ',')#'
>
> > #listgetat('#record#',5, ',')#'
>
> > #listgetat('#record#',6, ',')#'
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion 8 - Build next generation apps
today, with easy PDF and Ajax features - download now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:287242
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to