Reputation: 10703
When the date parameter has a date data type argument, the return value depends on the setting specified by using SET DATEFIRST. From DateName MSDN page
If I am trying
DateName(dw,getdate()) = 'sunday'
do I need to worry about setting the DATEFIRST? I don't think I have to because I am not using the integer return, I am checking the Name of the day of the week that it was. Is this correct?
Upvotes: 2
Views: 270
Reputation: 239684
The unasked question I think is - what's a reliable way to find a sunday.
I usually compare with a known good date of the right type:
IF DATEPART(dw,getdate()) = DATEPART(dw,'20130203')
Upvotes: 2