Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Monthly events calendar
Message
 
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Miscellaneous
Thread ID:
00779571
Message ID:
00779576
Views:
9
This message has been marked as a message which has helped to the initial question of the thread.
>>You may also try
 ... WHEN @FirstOfTheMonth + 0 BETWEEN StartDate And EndDate
>>-- instead of
>> ... WHEN StartDate <= @FirstOfTheMonth + 0 And EndDate >= @FirstOfTheMonth + 0
>>
I'm not sure if SQL Server could use any index to optimize query in this case.
>=========
>Why do you have only 29 days and why you have slightly different condition for the last day?
>
>I agree about using between... Funny, we're usually have something like
>field between FixedDay1 and FixedDay2, so it's hard to understand in the other way around, though should work as well.
>

You missed '...' after day29. :) I didn't want to repeat 30&31 because they are similar to 29. Not every month have 29 or more days. That's why there's additional check for that starting with day29.
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform