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)
 how to get dates within specific weeks

Author  Topic 

noms
Starting Member

22 Posts

Posted - 2008-09-18 : 04:25:21
hi
i need to get all dates which falls withing week 36,37,38,39.... weeks in separate columns

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-18 : 04:40:44
of a particular financial year you mean?
Go to Top of Page

noms
Starting Member

22 Posts

Posted - 2008-09-18 : 07:16:49
for this current year 2008
Go to Top of Page

NeilG
Aged Yak Warrior

530 Posts

Posted - 2008-09-18 : 07:20:03
use the datepart function i.e

select * from table where datepart(ww,date) in (36,37,38,39)

***************************
Life is for having Fun, and then a little work
Go to Top of Page

noms
Starting Member

22 Posts

Posted - 2008-09-18 : 08:42:31
thanks it works but there's a small twitch, in my table i have records from 2004 to 2009 so i need to use the function to only return records for the current year
Go to Top of Page

bjoerns
Posting Yak Master

154 Posts

Posted - 2008-09-18 : 08:44:42
Maybe you can transfer the DATEPART function from weeks to years?
Go to Top of Page

noms
Starting Member

22 Posts

Posted - 2008-09-18 : 09:25:27
thanks, i added datepart(yy,RequiredByDate) in (2008) in my where clause and i got it right.

thanks a lot from all of your guys
Go to Top of Page
   

- Advertisement -