Hi again ;) I've run into a stumbling block the my insert bombing out
due to some null fields and am not sure how to handle or account for
this. Any suggestions as to how to handle these without breaking the
insert?
Here's what I have thus far but of course it hangs when it reaches a row
without the full 18 elements in it.
<cfset record = 0 >
<cffile action="read" file="C:\Inetpub\wwwroot\www\testing\EPARank.txt"
attributes="readonly" variable="epafile" />
<cfloop index="line" list="#epafile#" delimiters="#chr(10)##chr(13)#">
<cfset record = record + 1 />
<cfif record neq 1 >
<cfquery name="insertNewTest" datasource="#dsdata#">
INSER INTO epadatatest
(
PID,
First_Name,
Middle_Name,
Last_Name,
Appointing_Dept,
Primary_Appt_Ind,
Primary_Rank_Ind,
Rank_Dept,
Rank_Title,
Rank_Scheduled_End_Dt,
Joint_Indicator,
Employee_Email,
Department_Chair1,
Chair_Email1,
Department_Chair2,
Chair_Email2,
HR_Facilitator,
HR_Facilitator_Email
)
VALUES
(
'#listgetAt('#line#',1, '#chr(9)#')#',
'#listgetAt('#line#',2, '#chr(9)#')#',
'#listgetAt('#line#',3, '#chr(9)#')#',
'#listgetAt('#line#',4, '#chr(9)#')#',
'#listgetat('#line#',5, '#chr(9)#')#',
'#listgetat('#line#',6, '#chr(9)#')#',
'#listgetat('#line#',7, '#chr(9)#')#',
'#listgetat('#line#',8, '#chr(9)#')#',
'#listgetat('#line#',9, '#chr(9)#')#',
'#listgetat('#line#',10, '#chr(9)#')#',
'#listgetat('#line#',11, '#chr(9)#')#',
'#listgetat('#line#',12, '#chr(9)#')#',
'#listgetat('#line#',13, '#chr(9)#')#',
'#listgetat('#line#',14, '#chr(9)#')#',
'#listgetat('#line#',15, '#chr(9)#')#',
'#listgetat('#line#',16, '#chr(9)#')#',
'#listgetat('#line#',17, '#chr(9)#')#',
'#listgetat('#line#',18, '#chr(9)#')#'
)
</cfquery>
</cfif>
</cfloop>
TIA!
Bob
-----Original Message-----
From: Paul Kukiel [mailto:[email protected]]
Sent: Friday, February 13, 2009 10:58 AM
To: cf-newbie
Subject: RE: looping a text file for an insert?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f
Archive:
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4364
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15