If every record follows the convention you described, this could work:

<cfquery name="getNames" datasource="oldDatasource">
SELECT 
        ID, 
        NAME 
FROM 
        oldTable 
WHERE 0 = 0
</cfquery>

<cfloop query="getNames">
        <cfquery name="insertNewRecord" datasource="newDatasource">
                UPDATE newTable
                SET 
                firstName = '#listgetat(getNames.name, listlen(basky.name) -
1, " ")#',
                lastName = '#listgetat(getNames.name, listlen(basky.name) -
2, " ")#'
                WHERE ID = #basky.ID#
        </cfquery>
</cfloop>

And you could probably do all of that in one SQL statement, but since it's
only ran once :|

Adam.



> -----Original Message-----
> From: Eric Creese [mailto:[EMAIL PROTECTED]
> Sent: Thursday, July 17, 2003 3:13 PM
> To: CF-Talk
> Subject: OT: Think you are a SQL GURU? Try figuring this one out.
> 
> 
> Here is the challenge.
> 
> Have a table with a column called NAME and the column 
> contains both names of businesses and individuals. Business 
> names are stored as is , example ABC Company. Individuals are 
> stored as last name first name middle initial, example Public 
> John Q. I need to get this information into another table 
> where the biz name can be stored in the first name field no 
> problem but I need to parse and individuals name so I can put 
> the individual's first name in the first name column and 
> their last name in the last name column. 
> 
> Figure it out and I will send you a prize.
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to