Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Cleanup 1

Status
Not open for further replies.

Albert3162

Programmer
Jul 13, 2001
18
0
0
US
Hi there,

I have data in Column "NAME" like:Timor D. Horbon.
How can I upload this in three dif column(FirstName, LastName, Mid)

thanks.
 
Try...

Code:
<cfloop list="#valuelist(QUERY.COLUMN)#" index="vlq">
  <cfif listlen(vlq," ") eq 3>
    <cfset vlfn=listfirst(vlq," ")>
    <cfset vlmn=listgetat(vlq,2," ")>
    <cfif right(vlmn,1) is ".">
      <cfset vlmn=left(vlmn,len(vlmn)-1)>
    </cfif>
    <cfset vlln=listlast(vlq," ")>
  <cfelse>
    <cfset vlfn=listfirst(vlq," ")>
    <cfset vlmn="">
    <cfset vlln=listlast(vlq," ")>
  </cfif>
  ...run your db insert here... vlfn = first, vlmn = middle, vlln = last... It also checks to make sure that there is a middle name... if there's no middle name, then the middle is set to ""...
</cfloop>

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top