SQL SERVER – UDF – User Defined Function – Get Number of Days in Month
Following User Defined Function (UDF) returns the numbers of days in month. It is very simple yet very powerful and full proof UDF. CREATE FUNCTION [dbo].[udf_GetNumDaysInMonth] ( @myDateTime DATETIME ) RETURNS INT AS BEGIN DECLARE @rtDate INT SET @rtDate = CASE WHEN MONTH(@myDateTime) IN (1, 3, 5, 7, 8, 10,…
Read More