July 21, 2010 at 2:27 pm
This should be an easy one to answer.
I want to create a date that is the first day of the month two months in the past from the current date. In other words, if today is 7/21/2010, I want to be able to build the date value 5/1/2010. I want to use the 5/1/2010 date as the beginning date in a date range and the current date as the last day in the date range. My date range would be 5/1/2010 to /7/21/2010.
I have been having fits getting this to work. Any and all ideas would be appreciated.
Thanks.
Ralph
July 21, 2010 at 2:35 pm
https://www.sqlservercentral.com/blogs/lynnpettis/archive/2009/03/25/some-common-date-routines.aspx
Good article by Lynn Pettis above that should get you started
________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day
July 21, 2010 at 2:36 pm
Something like this?
SELECT DATEADD(MONTH,DATEDIFF(MONTH,0,GETDATE())-2 ,0),GETDATE()
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply