SQL obtient un nombre de jours entre deux dates
DATEDIFF(DAY, '1/1/2011', '3/1/2011')
Lazy Lemur
DATEDIFF(DAY, '1/1/2011', '3/1/2011')
DECLARE @StartDate DATETIME
DECLARE @EndDate DATETIME
SET @StartDate = '2022/06/01'
SET @EndDate = '2022/06/30'
SELECT
(DATEDIFF(wk, @StartDate, @EndDate) * 2)
+(CASE WHEN DATENAME(dw, @StartDate) = 'Sunday' THEN 1 ELSE 0 END)
+(CASE WHEN DATENAME(dw, @EndDate) = 'Saturday' THEN 1 ELSE 0 END)