Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Apples
Posting Yak Master
146 Posts |
Posted - 2009-01-14 : 15:13:34
|
| Here is my schema:---------------------------------------------------------------tblEvents---------------------------------------------------------------EventName | StartMonth | StartDay | EndMonth | EndDay---------------------------------------------------------------Test | 4 | 3 | 4 | 12Test2 | 8 | 12 | 8 | 20---------------------------------------------------------------These basically work as a range of dates. Test is 4/3 - 4/12 and Test2 is 8/12-8/20. I haven't used the datetime type for these because the year is irrelevant, so I'm using integer types.I have a stored procedure that takes in a StartMonth, StartDay, EndMonth, EndDay. I want the procedure to check if the range of months and days interfere with any date range already in my table.I'm having lots of trouble with this, can anyone help? Here's my procedure:CREATE PROCEDURE [dbo].[sf_ValidateDateRange] ( @StartMonth int, @StartDay int, @EndMonth int, @EndDay int )AS SELECT COUNT(EventName) AS Expr1 FROM tblEvents WHERE (...)RETURN |
|
|
rohitkumar
Constraint Violating Yak Guru
472 Posts |
Posted - 2009-01-14 : 15:16:13
|
| set StartDay and EndDay as datetime columns even though you dont need year. working with datetime will be much less hassle than what you're getting into. |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2009-01-14 : 15:27:24
|
| How can you have events defined that have a month and day defined, but not a year?CODO ERGO SUM |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-14 : 23:31:14
|
| are you talking about recurring events which repeats in same period over years? |
 |
|
|
|
|
|