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)
 Week of the Month

Author  Topic 

whitmoj
Yak Posting Veteran

68 Posts

Posted - 2009-04-16 : 03:50:18
I have been reading over old post's about this and the following code works great for now SELECT DATEPART(DAY, GETDATE() - 1) / 7 + 1 AS theWeekWithinMonth but how can I applie this to a table that contains 2 months worth of data

Many Thanks


Whitmoj
If I have inspired one person today then my job is done.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-04-16 : 04:04:43
SELECT DATEPART(DAY, MyDateTimeColumnNameHere - 1) / 7 + 1 AS


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

whitmoj
Yak Posting Veteran

68 Posts

Posted - 2009-04-16 : 04:10:11
Many thanks I tried this first but no look. It now works

Whitmoj
If I have inspired one person today then my job is done.
Go to Top of Page
   

- Advertisement -