DataBase/SQL Server
년, 월 주차
탑~!
2018. 4. 16. 11:58
-- 월 주차
DECLARE @DTCUR DATETIME = '20180416'
DECLARE @DT CHAR(8)
SET @DT = CONVERT(CHAR(8), @DTCUR, 112)
SELECT DATEPART(WK, @DT) - DATEPART(WK, LEFT(@DT, 6) + '01') + 1
-- 년주차
SELECT DATEPART(WEEK,CAST(@DTCUR AS DATETIME))