How do I get the date of upcoming/next Friday using SQL?
If the current day is Friday, then return today's date.
Thanks so much, any tips and advice appreciated!
How do I get the date of upcoming/next Friday using SQL?
If the current day is Friday, then return today's date.
Thanks so much, any tips and advice appreciated!
declare @date datetime
select @date = GETDATE()
SET DATEFIRST 6
SELECT DATEADD(d, 7 - DATEPART(dw, @Date), @Date)
Try this
SET DATEFIRST 7
SELECT DATEADD(DAY,(CASE DATEPART(DW,GETDATE())
WHEN 7 THEN 6
ELSE 6 - DATEPART(DW,GETDATE()) END),GETDATE());