I am running SQL Server 2008 on a machine with regional settings that have Monday as the first day of the week. If I create a computed column in a table to compute the day of week for a date field then I get 2 for a Monday date instead of 1.
Is there some property for the table or database or server that I need to set ?
The first day of the week is based on your language settings of the server. The default setting for us_english is 7 (Sunday)
You can find the current first day of the week by using SELECT @@DATEFIRST
However, you can use DATEFIRST
for this. Just put it at the top of your query
SET DATEFIRST 1;
this sets Monday to the first day of the week for the current connection.