We help IT Professionals succeed at work.
Get Started

Create a date from a parameter in SQL stored procedure

Last Modified: 2012-05-09
Hi Everyone,

Im really having a hard time understanding dates and how to calculate them.

I have a form where there are two dropdowns ...

Dropdown 1 - displays two options - Fixed Date / Fixed Day
Dropdown 2 - dependent on what is selected will display 1-31 if Fixed Date or Mon-Sun if fixed day.

I then have a button to calculate the date which will run a stored procedure, which at the moment looks like this ...

      @EFOLDERID nvarchar(50), --FolderID to ensure only certain rows are updated
      @DATETYPE nvarchar (50), --Either Fixed Date or Fixed Day
      @DATEINCREMENT int, --Value to increase the date type by
      @DATEFROM datetime --Either the previous milestone added or if Milestone 1 then todays date

if (@DATETYPE = 'Fixed Date')



I have only started it for the first date type at the moment so I dont bite off more than I can chew, I have read quite a lot about calculating dates but nothing really specific to what I want to achieve. Hopefully you can help, but if anyone has any good resources for creating/calculating  dates then I would be very greatful again.

Thanks in advance.

Watch Question
Topic Advisor, Page Editor
Distinguished Expert 2018
This problem has been solved!
Unlock 2 Answers and 24 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE