NetworkGuy101
IS-IT--Management
I am trying to simulate an autonumber for a defined query. I would like to choose all records where EventID is Null and eventdate = #Entereddate# ordered by eventtime
Once I get those results I want to loop through them placing a 1 in the first record and then incrementing by one in the following records. Here is my coe so far It is pretty scary looking I know. All help is definitly appreciated.
Joe
<cfset entereddate = "1/28/2004">
<cfquery name="AllEvents" datasource="test">
SELECT * FROM Events WHERE eventid is Null AND eventdate = '#entereddate#' orderby eventtime desc
</cfquery>
<cfloop query="eventq">
<cfquery name="addeventid" datasource="test">
SELECT * FROM Events WHERE eventid is Null AND eventdate = '#entereddate#' order by eventtime desc
</cfquery>
<cfset totals = #addeventid.RecordCount#>
<cfoutput>
<cfset add1 = #totaly# - 1>
</cfoutput>
<cfquery name="eventid" datasource="test">
UPDATE Events SET eventid= (
#add1#
) Where events.eventdate = #entereddate#
</cfquery>
</cfloop>
Once I get those results I want to loop through them placing a 1 in the first record and then incrementing by one in the following records. Here is my coe so far It is pretty scary looking I know. All help is definitly appreciated.
Joe
<cfset entereddate = "1/28/2004">
<cfquery name="AllEvents" datasource="test">
SELECT * FROM Events WHERE eventid is Null AND eventdate = '#entereddate#' orderby eventtime desc
</cfquery>
<cfloop query="eventq">
<cfquery name="addeventid" datasource="test">
SELECT * FROM Events WHERE eventid is Null AND eventdate = '#entereddate#' order by eventtime desc
</cfquery>
<cfset totals = #addeventid.RecordCount#>
<cfoutput>
<cfset add1 = #totaly# - 1>
</cfoutput>
<cfquery name="eventid" datasource="test">
UPDATE Events SET eventid= (
#add1#
) Where events.eventdate = #entereddate#
</cfquery>
</cfloop>