Solved

Need help with running script within certain set parameter X amount of days.

Posted on 2011-09-08
1
164 Views
Last Modified: 2012-05-12
Hello,

I have several dates within a column that I would like to run a script on that will update column based off of the date within the column.

My date looks like this..."2011-06-07 09:02:00" The time doesn't matter so it would be something like...

<cfquery>
UPDATE TABLE
SET columnB = #myNewData#
WHERE LastUpdatedDate = within X amount of days
</cfquery>

I have X date because I want to be able to adjust the days as I need to.

Thx,

Brian
0
Comment
Question by:brihol44
1 Comment
 
LVL 39

Accepted Solution

by:
gdemaria earned 125 total points
ID: 36510220

when you say within X number of Days, not sure what "within" means - is that X days more than, less than or either side of the date?  And which date?  Today?  Or a date you supply?


This example is X days before a given date up until that date...
<cfset targetDate = "12/15/2002">
<cfset numbDays = 12">

WHERE LastUpdatedDate between #createODBCdate(dateAdd("d",-numbDays,targetDate))# and #createODBCdate(targetDate)#

would give 12/3 through 12/15

This example is the X number of days before today and any day after that...

WHERE LastUpdatedDate >= #createODBCdate(dateAdd("d",numbDays,getDate()))#


0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Entering multiple email addresses 4 76
query of query sort 6 106
Coldfusion retrieve dynamic values 1 39
MYSQL database problem within Coldfusion 2016 environment 12 49
This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question