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 2000 Forums
 Transact-SQL (2000)
 function related

Author  Topic 

kiranmurali
Yak Posting Veteran

55 Posts

Posted - 2010-07-18 : 13:57:42
how to write a function which will return month year week wkstart wkend for the given date.

pls give some ideas?

Thanks in Advance,
KiranMurali

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2010-07-18 : 15:17:31
[code]
select
getdate() as date
,month(getdate()) as month
,year(getdate()) as year
,datepart(week,getdate()) as week
,dateadd(wk,datediff(wk,6,getdate()),6) as wkstart
,dateadd(wk,datediff(wk,5,getdate()),5) as wkend

[/code]
Go to Top of Page
   

- Advertisement -