NTSPL Blog logo
NTSPL Insights

Find first sunday of the month in SQL Server

02 Aug 2013
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

Recent Posts

AI-Ready Digital Strategy: SEO, AEO & GEO | NTSPL

Why Every Business Needs an AI-Ready Digital Strategy | SEO, AEO &...

04 Aug 2026
Odoo ERP Implementation Services for Growing Businesses | NTSPL

From Disconnected Operations to One Smart Platform: How Odoo ERP Transforms Growing...

31 Jul 2026
NTSPL NexusOne Intranet Portal | Digital Workplace

NTSPL NexusOne Intranet Portal: Building a Connected Digital Workplace for Modern Teams.

14 Jul 2026
MongoDB for RAG Applications

MongoDB for RAG Applications: Why Developers Are Choosing It for GenAI Apps.

14 May 2026
Agentic Commerce 2026: MongoDB, AP2, UCP & AI Payment Architecture Explained

Agentic Commerce in 2026: How MongoDB Enables Secure AI-Driven Transactions.

27 Apr 2026
facebook icon twitter icon instagram icon youtube icon youtube icon
  • Home
  • About Us
  • Career
  • Contacts
  • Privacy Policy
  • Term & Conditions
Copyright © 2022 NTSPL. All Rights Reserved.