Tag Archives: Sunday in a month

Get No of Sundays in a month SQL Server

The following stored procedure returns number of sundays in given month. It takes date as parameter. Month and year is extract from the date. CREATE FUNCTION GetSundays (@giveDate DATETIME) RETURNS INT AS BEGIN DECLARE @firstday DATETIME, @lastday DATETIME SELECT @firstday … Continue reading

Posted in SQL Server 2008 | Tagged , | Leave a comment