sknox (1/4/2013)
nigel. (1/4/2013)
Thanks Steve for the question.Thought I'd throw this in just for fun. Should work for every day of the year:
SELECT DATEADD(DAY, -DATEPART(dayofyear,GETDATE()),GETDATE())
The only problem with that is, since getdate() returns a datetime[2]*, you're actually returning some time during the day on New Years Eve rather than the day of New Years Eve itself.
...
Very good point. How about this one:
SELECT DATEADD(year,DATEDIFF(YEAR,'19001231',GETDATE())-1,'19001231')