SQL Server & Tibco Spotfire Ideas & Samples
SQL, TSQL, Tibco Spotfire...
Apr 7, 2009
Finding week of the month in sqlserver 2005
DECLARE @DATE VARCHAR(50)
SET @DATE ='04/03/2009'
select cast(datename(week,@DATE) as int)- cast( datename(week,dateadd(dd,1-day(@DATE),@DATE)) as int)+1
---------------------------
SELECT DATEPART(DAY, GETDATE()-10) / 7 AS WeekofMonth
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment