I have a Query where I get the WeekDay of a date but by default:
Sunday = 1
Moday = 2
etc.
You can use this formula regardless of DATEFIRST
setting :
((DatePart(WEEKDAY, getdate()) + @@DATEFIRST + 6 - [first day that you need] ) % 7) + 1;
for monday = 1
((DatePart(WEEKDAY, getdate()) + @@DATEFIRST + 6 - 1 ) % 7) + 1;
and for sunday = 1
((DatePart(WEEKDAY, getdate()) + @@DATEFIRST + 6 - 7 ) % 7) + 1;
and for friday = 1
((DatePart(WEEKDAY, getdate()) + @@DATEFIRST + 6 - 5 ) % 7) + 1;