oh god don't do that !!! Use the SQL date functions to do the comparison,
you could do all that stuff in one query

UPDATE Ads
SET online_approval = '2'
WHERE ad_id in (

SELECT ad_id
FROM Ads
WHERE DATEADD(day, 30, posted_on) > GetDate()

)



1 query V's 1 x Rows

Justin

>-----Original Message-----
>From: Bosky, Dave [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, November 21, 2000 7:58 PM
>To: CF-Talk
>Subject:
>
>
>I'm trying to compare the current date to an expire-on date and
>mark the ad
>as expired if the datecompare function returns a value gte 0. Everything
>seems
>ok except that it marks every ad as expired regardless of returned value.
>
><CFLOOP QUERY="GetEntries">
><CFSET AdWasPlacedOnThisDate = posted_on>
><CFSET expiration_date = #dateformat(DateAdd('D', 30,
>AdWasPlacedOnThisDate), "DD-MMM-YY")#>
><CFSET comparison = DateCompare(CurrentDate,expiration_date>
><CFIF comparison GTE 0>
><CFQUERY datasource="xxx" DBTYPE="ODBC">
>       UPDATE Ads
>       SET online_approval = '2'
>       WHERE ad_id = ad_id
></CFQUERY>
></CFIF>
></CFLOOP>
>
>Thanks
>
>Dave Bosky
>HTC Web Application Developer
>843.369.8613
>[EMAIL PROTECTED]
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to