Where (DYYYY = (year( getdate() +1)))DatePart(month, GETDATE())) + '/' + DatePart(day, GetDate())) -1 + '/' + DatePart(year, GetDate())) +1)
I am having 开发者_开发百科trouble running a query where i can use yesterdays date, but next year for projections.
Will this give you what you're looking for?
DATEADD(yy, 1, DATEADD(dd, -1, getdate()))
If you want to exclude the time component, then you can use a variation like this
DATEADD(yy, 1, DATEADD(dd, datediff(dd, 0, getdate()), -1))
精彩评论