how to get data of current week only in SQL server?

前端 未结 7 1935
逝去的感伤
逝去的感伤 2020-12-29 03:18

I want records from table which stores the current date when a record is inserted with in current week only.

I have tried:

SELECT PId 
,WorkDate 
,Ho         


        
7条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-29 03:55

    A better way would be

    select datepart(ww, getdate()) as CurrentWeek
    

    You can also use wk instead of ww.

    Datepart Documentation

提交回复
热议问题