SELECT DATEADD(d,
case when(datepart(dd,DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE()),0)))=31) then -11
when(datepart(dd,DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE()),0)))=30) then -10
when(datepart(dd,DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE()),0)))=29) then -9
else -8 end,
DATEADD(mm, DATEDIFF(m,0,GETDATE()),0))
Tag: 21st date of any month in sql, 21st date of any month in sql server, last date of any month in sql server, last date of month in sql, last date of month in sql server
No comments:
Post a Comment