Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 week starting from a specific day of week.

Author  Topic 

sreenu9f
Yak Posting Veteran

73 Posts

Posted - 2010-04-22 : 11:47:31
I would like to get week extracted from the datetime column but the problem with datepart function is it calculates the week from sunday. i would like to start a week from a specific day of week. for example Apr 1 (Thursday) as the start of the week and ends at wednesday 7th of april.

can some one suggest if it is possible to do that way.

Thanks

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2010-04-22 : 11:56:17
Check the below link. It may of some help to you
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=47307
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-04-23 : 02:18:51
you need to change datefirst setting

http://msdn.microsoft.com/en-us/library/ms181598.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

deepakugale
Starting Member

33 Posts

Posted - 2010-04-23 : 03:35:49
SET DATEFIRST { number } ;

For your reference

DAY NAME NUMBER
Monday 1
Tuesday 2
Wednesday 3
Thursday 4
Friday 5
Saturday 6
Sunday 7 (default)


Go to Top of Page
   

- Advertisement -