Tuesday, February 28, 2023

Get Only Firdays in SQL

 SELECT Fridays = DATEADD(yy, DATEDIFF(yy, 0, GETDATE()), n.num)

FROM (SELECT TOP 366 num = ROW_NUMBER() OVER(ORDER BY a.NAME)-1 FROM dbo.syscolumns a, dbo.syscolumns b) n

WHERE DATENAME(weekday, DATEADD(yy, DATEDIFF(yy, 0, GETDATE()), n.num)) = 'Friday'





No comments:

Post a Comment

Screen Record

 Windows Screen Record WindowsKey+ Alt + R Recording Starts.