How can I automatically declare the last 6 COMPLETE months?
For example, today is 1/20/10, so I would like the StartDate to be 7/1/09 and the end date to be 12/31/09.
This is what I currently use:
set @@StartDate = '2009-07-01'
set @@EndDate = '2009-12-31'
How can I write this in t-sql using the dateadd function so that it is automatic and I don't need to manually change the code every time?
View Complete Post