Whoa whoa.. slow down there with the send button :)
The process would go like so...
<!--- Select all your records from the database --->
<cfquery name="recs" datasource="myDsn">
Select * from table
</cfquery>
<!--- now loop the records and change the value and update the record --->
<cfloop query="recs">
<cfset var1 = listdeleteat(querycolumn, listlen(querycolumn, "-"), "-")>
<cfset newvalue = var1 & "_" & listlast(querycolumn, "-")>
<cfquery datasource="myDSN">
UPDATE table
Set querycolumn = '#newvalue#'
Where TheRecordsID = #TheRecordsID#
</cfquery>
</cfloop>
ThatÂ’s it...
Querycolumn of course is the field name in your database that holds the
values you are trying to edit.
TheRecordID is the primary key for the table
So if the table with those records looks like so...
FieldID MyValue
--------------------------------
1 Adi5RT-Flo12Roy-3(Lg)
2 Adi5RT-FSU2Red-2(Md)
3 Adi5RT-FSU2Red-3(Lg)
4 Adi5RT-FSU2Red-4(XL)
5 Adi5RT-FSU2Red-5(2X)
6 Adi5RT-FSU3Wht-2(Md)
7 Adi5RT-FSU3Wht-3(Lg)
--------------------------------
The querycolumn would be 'MyValue' and the TheRecordID would be 'FieldID'.
-----Original Message-----
From: Ken [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 03, 2005 9:16 PM
To: CF-Talk
Subject: Re: String replace
Hi. This may be a stupid question, but which of this loops can I use
to run a update SQL statement to replace the original values with the
new ones?
Thanks again.
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.8/61 - Release Date: 8/1/2005
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:213698
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54