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 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply