Share

It required check Sunday when you generate installment schedule using Store Procedure.


declare @sun datetime
set @sun=DATEADD(Month, DATEDIFF(Month, 0, GETDATE()) + 0, 0) +
6 - (DATEPART(Weekday,DATEADD(Month,DATEDIFF(Month,0, GETDATE()) + 0, 0))
+ @@DateFirst + 5) % 7

print @sun

Share