TSQL Calculate week number of the month

前端 未结 5 730
逝去的感伤
逝去的感伤 2020-12-06 13:20

I want to calculate the week number of the month,I want to calculate the week number whether its odd or even week how can I get this in TSQL ? Thanks all!

5条回答
  •  旧巷少年郎
    2020-12-06 14:04

    It will give you week Number for Every month

    declare @dates datetime
    select @dates='2011-03-22'
    SELECT datepart(dd,@dates), ceiling (cast(datepart(dd,@dates)as numeric(38,8))/7)  
    

提交回复
热议问题