Here's one way to do it (I don't know if it is the most  
efficient)

You just need to rename Table1 to your table name and aa_test to  
your datasource

<cfquery name="get_students" datasource="aa_test"  
dbtype="ODBC">
SELECT studentid,studentdetails
FROM Table1
</cfquery>

<cfloop query="get_students">
<cfset myString=studentdetails>

<cfset new_string=ListFirst(myString,"-")>

<CFQUERY NAME="UpdateClient" DATASOURCE="aa_test">
UPDATE   Table1   
SET studentdetails='#Trim(new_string)#'
WHERE Table1.studentid=#studentid#
</CFQUERY>

</cfloop>

================ You wrote ================

>>
>>
>>Hello,
>>
>>Can someone please help me.
>>I wish to delete part of a text in "student" field keeping part  
of the text in the same field intact.
>>
>>Database: Access.
>>Table name is: TopStudents
>>The field names are: studentid, studentdetails, percentage,  
grade.
>>The contents of the rows in the "studentdetails" field are  
similar to this:
>>
>>Student Name1 - Year 1950
>>Student Name2 - Year 1953
>>Student Name3 - Year 1953
>>Student Name4 - Year 1953
>>Student Name5 - Year 1954
>>
>>
>>I have about 500 rows of data in the table.
>>What I wish to do is to keep the student names in the rows intact  
and delete
>>everything on the righthand side from the -.
>>
>>Any help would be much appreciated.
>>
>>Regards
>>SB
>>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to