<!---Get records and rowid (oracles pecific)--->
<cfquery datasource="#request.dsn#" name="tester">
select req_incr_id, rowid
from rem_apvl_dtl
</cfquery>
You can see how easy this is. Now once all of your records have been updated you can go back and fix your queries or add a sequence to your table to increment the id from here on out.<!---loop through each individual record--->
<cfloop query="tester"><!---Start the count based on one record I manually altered ad set to 1, you could do this differently--->
<cfif tester.req_incr_id eq 1>
<cfset mark = 1>
<cfelse>
<cfset mark = mark +1>
</cfif><!---Now update your unique ID with the incremented number--->
<cfquery datasource="#request.dsn#" name="markit">
UPDATE rem_apvl_dtl
SET req_incr_id = '#mark#'
where rowid = '#rowid#'
</cfquery></cfloop>
If you inadvertently screw up on the data in the field you can always remove it and add it again.
Labels: coldfusion, loop, oracle, rowid

0 Comments:
Post a Comment
Links to this post:
Create a Link
<< Home