June 19, 2006 at 2:51 pm
I am working on a new billing cycle. I will now bill on the first day of each month.
I get the first day of each month by the following:
DECLARE @dt DATETIME
DECLARE @dt2 VARCHAR(10)
set @dt=(select CAST(LEFT(GETDATE()-DAY(GETDATE())+1,11) AS datetime))
set @dt2=(select REPLACE(CONVERT(VARCHAR(10), @dt, 101), '/', '') AS datetime)
select @dt2
What I would like to know is how would I get the date minus Month. For example, I would get the current date of 06012006 and want all transactions from the previous month.
Any ideas?
June 20, 2006 at 7:04 am
Thank you
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply