sure of a few things. Make sure that the only commas in the file are the
delimiters. Check to make sure your not putting a string into an int
field. Also, you have a comma at the end of your SQL statement.
'#ListGetAt(l, 21)#',
)
</cfquery>
Phillip B.
Jillian Carroll wrote:
> Good morning,
>
> I am having a heck of a time with this little import script. When it
> runs,
> all I receive are the messages that 'An error occurred while updating the
> database.' (as I indicated it should do if the query fails)
>
> Can anybody point me in the right direction?
>
> Thanks!!
>
> --
> Jillian
>
> *** *** ***
>
> <!--- Identify the CSV source file --->
> <cffile action="" file="/data/intr/pages/tools/data.csv"
> variable="csv_import">
>
> <!---
> Identify the line delimiter
> chr(13) = carriage return
> A complete list can be found at http://www.asciitable.com
> --->
> <cfset dm = chr(13)>
>
> <cfoutput>
> <!--- Loop through each line in the CSV source file, using the
> delimiter specified. --->
> <cfloop index="k" list="#csv_import#" delimiters="#dm#">
> <!--- Loop through all records on each line, using the
> delimiter specified. --->
> <cfloop index="l" list="#k#" delimiters=",">
> <!---
> Wrap action in cftry tag to catch any
> problems, and display an
> error message in case the database update is
> unable to be completed.
> --->
> <cftry>
> <!--- Perform SQL insert --->
> <cfquery name="insert" datasource="#DSN#">
> INSERT INTO person_temp (
> person_id,
> salutation_id,
> first_name,
> last_name,
> title,
> qualification,
> organization_id,
> department_id,
> office_id,
> status,
> role_id,
> org_position,
> national_board,
> userid,
> password,
>
> work_phone,
> work_phone_ext,
> fax_phone,
> cell_phone,
> pager_phone,
> email_wireless,
> lung_family,
> )
> VALUES (
>
> nextval('"person_person_id_seq"'::text),
> #ListGetAt(l, 1)#,
> '#ListGetAt(l, 2)#',
> '#ListGetAt(l, 3)#',
> #ListGetAt(l, 4)#,
> '#ListGetAt(l, 5)#',
> #ListGetAt(l, 6)#,
> #ListGetAt(l, 7)#,
> #ListGetAt(l, 8)#,
> '#ListGetAt(l, 9)#',
> #ListGetAt(l, 10)#,
> #ListGetAt(l, 11)#,
> #ListGetAt(l, 12)#,
>
> '#ListGetAt(l, 13)#',
> '#ListGetAt(l, 14)#',
>
> '#ListGetAt(l, 15)#',
> '#ListGetAt(l, 16)#',
> '#ListGetAt(l, 17)#',
> '#ListGetAt(l, 18)#',
> '#ListGetAt(l, 19)#',
>
> '#ListGetAt(l, 20)#',
> '1',
> '#ListGetAt(l, 21)#',
> )
> </cfquery>
>
> <!--- If the update succeeds, display
> confirmation message. --->
> <br /><br />
> Database update completed.
>
> <!--- If the update failes, display error
> message. --->
> <cfcatch type="any">
> <br /><br />
> An error occured while updating the
> database.
> </cfcatch>
> </cftry>
> </cfloop>
> </cfloop>
> </cfoutput>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

