December 17, 2010 at 11:52 am
I have this date parameter that I would like to edit.
BETWEEN DATEADD(MONTH, - 6, @StartDate) AND dbo.DateOnly(@StartDate))
Can you help me change this so that it goes from the first day of the 6th month to the start date?
(eg, when I select 12/17/2010 as the start date, the range will be: 6/1/2010 to 12/17/2010)
Thank you in advance for your help! It is much appreciated!
December 17, 2010 at 12:04 pm
Something like this perhaps?
BETWEEN DATEADD( mm, DATEDIFF( mm, 0, @StartDate) - 6, 0) AND DATEADD( dd, DATEDIFF( dd, 0, @StartDate), 0)
Note I removed your dbo.DateOnly function and swapped it out for the currently best known method for speed.
Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.
For better assistance in answering your questions[/url] | Forum Netiquette
For index/tuning help, follow these directions.[/url] |Tally Tables[/url]
Twitter: @AnyWayDBA
December 17, 2010 at 12:41 pm
thanks! that worked!
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply