[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Update date records with dateAdd()

Posted on 2006-03-20
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.


Question by:dBedient
1 Comment
LVL 14

Accepted Solution

adwiseman earned 500 total points
ID: 16239103
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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
Suggested Courses

834 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