Click here to Skip to main content
16,011,436 members
Home / Discussions / Database
   

Database

 
QuestionFinding recurring dates. Pin
T-Smooth11-Sep-06 3:06
T-Smooth11-Sep-06 3:06 
AnswerRe: Finding recurring dates. Pin
Eric Dahlvang11-Sep-06 3:50
Eric Dahlvang11-Sep-06 3:50 
GeneralRe: Finding recurring dates. Pin
T-Smooth11-Sep-06 5:48
T-Smooth11-Sep-06 5:48 
AnswerRe: Finding recurring dates. Pin
Eric Dahlvang11-Sep-06 6:42
Eric Dahlvang11-Sep-06 6:42 
GeneralRe: Finding recurring dates. Pin
T-Smooth11-Sep-06 8:24
T-Smooth11-Sep-06 8:24 
GeneralRe: Finding recurring dates. Pin
Eric Dahlvang11-Sep-06 10:19
Eric Dahlvang11-Sep-06 10:19 
AnswerRe: Finding recurring dates. Pin
Michael Potter11-Sep-06 10:20
Michael Potter11-Sep-06 10:20 
GeneralRe: Finding recurring dates. Pin
Eric Dahlvang11-Sep-06 10:55
Eric Dahlvang11-Sep-06 10:55 
I guess he wants every third Sunday from the start date, not every third Sunday of the month. I had the same misunderstanding.

But, I like your method better than creating a table with every date between now and some arbitrary future date.

CREATE PROCEDURE RecurringDates_ThirdSunday
   (
      @Start DATETIME,
      @End DATETIME
   )
   AS
    DECLARE @curDt DATETIME
    SET @curDt = @Start
    
    DECLARE @t TABLE (GoodDate DATETIME NOT NULL)
    
    WHILE DATEPART(dw,@curDt) != 1
    BEGIN
        SET @curDt = DATEADD(dd,1,@CurDt)
    END

    SET @curDt = DATEADD(dd,14,@CurDt) 

    WHILE @curDt <= @End
    BEGIN
 	INSERT INTO @t (GoodDate) VALUES (@curDt)
        SET @curDt = DATEADD(dd,21,@CurDt)
    END
    
    SELECT *
    FROM @t


--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters

QuestionCondition as parameter of sp ... ? [modified] Pin
devboycpp10-Sep-06 23:22
devboycpp10-Sep-06 23:22 
AnswerRe: Condition as parameter of sp ... ? Pin
_AK_10-Sep-06 23:29
_AK_10-Sep-06 23:29 
GeneralRe: Condition as parameter of sp ... ? [modified] Pin
devboycpp10-Sep-06 23:38
devboycpp10-Sep-06 23:38 
GeneralRe: Condition as parameter of sp ... ? Pin
_AK_10-Sep-06 23:55
_AK_10-Sep-06 23:55 
GeneralRe: Condition as parameter of sp ... ? Pin
devboycpp11-Sep-06 0:24
devboycpp11-Sep-06 0:24 
GeneralRe: Condition as parameter of sp ... ? Pin
_AK_11-Sep-06 0:33
_AK_11-Sep-06 0:33 
AnswerRe: Condition as parameter of sp ... ? Pin
Eric Dahlvang11-Sep-06 3:08
Eric Dahlvang11-Sep-06 3:08 
QuestionNavigation buttons Pin
Ranjita Ghosh10-Sep-06 21:41
Ranjita Ghosh10-Sep-06 21:41 
AnswerRe: Navigation buttons Pin
Tushar Kothari11-Sep-06 1:06
Tushar Kothari11-Sep-06 1:06 
GeneralRe: Navigation buttons Pin
Ranjita Ghosh11-Sep-06 1:48
Ranjita Ghosh11-Sep-06 1:48 
QuestionCatching errors raised by SP Pin
Uma Kameswari10-Sep-06 21:40
Uma Kameswari10-Sep-06 21:40 
AnswerRe: Catching errors raised by SP Pin
Tushar Kothari11-Sep-06 1:10
Tushar Kothari11-Sep-06 1:10 
GeneralRe: Catching errors raised by SP Pin
Amit Kumar G12-Sep-06 16:28
Amit Kumar G12-Sep-06 16:28 
QuestionCannot edit the existing record Pin
Ranjita Ghosh10-Sep-06 21:09
Ranjita Ghosh10-Sep-06 21:09 
AnswerRe: Cannot edit the existing record Pin
Tushar Kothari11-Sep-06 1:13
Tushar Kothari11-Sep-06 1:13 
GeneralRe: Cannot edit the existing record Pin
Ranjita Ghosh11-Sep-06 1:36
Ranjita Ghosh11-Sep-06 1:36 
GeneralRe: Cannot edit the existing record Pin
Tushar Kothari11-Sep-06 1:39
Tushar Kothari11-Sep-06 1:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.