SELECT DATEADD(day, (DATEPART(week, GETDATE()) * 7
+ DATEPART(weekday, GETDATE()))
- (DATEPART(week, DATEADD(year, -1, GETDATE())) * 7
+ DATEPART(weekday, DATEADD(year, -1, GETDATE()))), DATEADD(year, -1, GETDATE())) as LastYearDate
RESULT
LastYearDate
2008-05-22 11:14:26.350
No comments:
Post a Comment