May 19, 2015 at 12:36 am
DELETE FROM Report_temp2
WHERE MSSalesID in
( Select Report_temp.MSSalesID FROM Report_temp)
DELETE FROM Report_temp
WHEREMSDate < '2015-07-01'
Actually the year stating form july.Q1 is july,aug,sep.Q2 is oct nov,dec.Q3 is jan,feb,mar.Q4 is april, may,june.So what I need help is dynamically I want to delete the data every year prior to current year.
May 19, 2015 at 11:21 am
Try:
where
MSDate < DATEADD(MONTH,
6,
DATEADD(YEAR,
DATEDIFF(YEAR, 0, @data) - 1 + MONTH(@DATA) / 7,
0))
Hope this helps.
May 20, 2015 at 4:52 am
Thank you very much this is really helpful to me
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply