Click here to Skip to main content
15,914,608 members
Home / Discussions / Database
   

Database

 
AnswerRe: Problem with SQL 2005 Express: View Sorting Order Pin
Eric Dahlvang12-Sep-06 3:25
Eric Dahlvang12-Sep-06 3:25 
QuestionSQL SERVER Pin
lakshmi_sri11-Sep-06 18:08
lakshmi_sri11-Sep-06 18:08 
AnswerRe: SQL SERVER Pin
Farhan Noor Qureshi11-Sep-06 18:57
Farhan Noor Qureshi11-Sep-06 18:57 
AnswerRe: SQL SERVER Pin
Colin Angus Mackay11-Sep-06 22:44
Colin Angus Mackay11-Sep-06 22:44 
QuestionHow to define a null-ignoring unique constraint Pin
supercali11-Sep-06 15:41
supercali11-Sep-06 15:41 
AnswerRe: How to define a null-ignoring unique constraint Pin
Farhan Noor Qureshi11-Sep-06 18:59
Farhan Noor Qureshi11-Sep-06 18:59 
GeneralRe: How to define a null-ignoring unique constraint Pin
supercali12-Sep-06 4:16
supercali12-Sep-06 4:16 
QuestionFinding recurring dates. Pin
T-Smooth11-Sep-06 3:06
T-Smooth11-Sep-06 3:06 
Using SQL Server 2000 here and I have a table named "Calendar" that is an auxillary table created using scripts found on the web. Basically, the calendar contains an entry for every day for the next several years that has a datetime field, fields for the day of the month, month of the year, the year, the week of the year, etc. I'm trying to write a query or set of queries to return the recurring dates if the user of a web app decides to schedule something on a recurring basis much like recurring appointments in Outlook Calendar.

The following query is what I am using to attempt to return the every 3rd Sunday starting on 01/01/08.
<br />
SELECT c.dt, c.dayname, c.monthname, c.M, c.D, c.Y, c.W<br />
FROM dbo.Calendar c <br />
WHERE c.dayname IN ('Sunday')<br />
AND c.dt >= '01/01/08' <br />
AND c.Y IN (2008, 2009) <br />
AND 0 = ((SELECT COUNT(*) FROM <br />
dbo.Calendar c2 <br />
WHERE c.dt >= c2.dt<br />
AND c.dayname = c2.dayname) % 3) <br />
ORDER BY c.dt<br />
GO


The query is returning every 3 sunday's but it's starting with Jan. 13th (the 2nd sunday) instead of Jan. 20th (the 3rd Sunday). After that, it is returning every 3rd Sunday but it is off by 1 week because of where it's starting.

What am I doing wrong? Also, what kind of modifications might I need to make to this to support the other recurring event patterns that can be found in Outlook? I've searched the web a lot for recurring events and all I can seem to find is how to create the auxillary calendar table that I created but no info on how to retrieve the dates that a recurring event should fall on.
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 
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 

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.