To get the total no of days in a month in sql
Query
DECLARE @sample datetime
SET @sample=GETDATE() -- Sample date
select datediff(dd,dateadd(dd, 1-day(@sample),@sample), dateadd(m,1,dateadd(dd, 1-day(@sample),@sample)))
Query
DECLARE @sample datetime
SET @sample=GETDATE() -- Sample date
select datediff(dd,dateadd(dd, 1-day(@sample),@sample), dateadd(m,1,dateadd(dd, 1-day(@sample),@sample)))
No comments:
Post a Comment