We help IT Professionals succeed at work.

Update date records with dateAdd()

dBedient asked
Medium Priority
Last Modified: 2008-03-03
I know I cannont do this with Coldfusion without multiple steps, but I think I should be able to accomplish it with a stored procedure. My question is how?

I have a couple of variables:

@groupID int, // the group identifier
@newdatediff int // the number of days to add

I want to update the different iDate dates using dateAdd() and the newdatediff number. I'm guessing here:

SET iDate = dateAdd([day], @newdatediff, iDate)

I have limited knowledge of how to set it up as you can tell. Any help would be greatly appreciated.


Watch Question

Like this, in a stored procedures I think is what your looking for.
You could also perform this directly using the SQL In this procedure, I recomend writing a Stored Procedure though.

    @groupID int,
    @newdatediff int

SET iDate = dateadd(day, @newdatediff, iDate)
WHERE groupID = @groupID

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.