Gerrit Mantel
Programs SQL_SCALAR_FUNCTION - fun_date2month

Main program

Namefun_date2month
Type_descSQL_SCALAR_FUNCTION
CommentSQLServer User-Defined Function

PURPOSE
Return the description of the month for a given date.

PARAMETERS
@datum_in DATETIME Given date
@taal_in VARCHAR(2) Language ([UK], NL)
@lengte_in INT Length (1-[9])
@lett_in VARCHAR(1) Case ([C]=Capitalized, U=Uppercase, L=Lowercase)
RETURNS VARCHAR(9) Description of the month

EXAMPLES
1)
SELECT dbo.fun_date2month(GETDATE(), 'NL', 3, 'U')
MEI

2)
SELECT dbo.fun_date2month(salarisdat,'NL',3,'C') AS Mnd,
DATEPART(yyyy, salarisdat) AS Jaar,
SUM(salaris) AS Sal
FROM dbo.T_SALARISSEN
WHERE DATEPART(yyyy, salarisdat) = 2005
GROUP BY dbo.fun_date2month(salarisdat, 'NL', 3, 'C')

Mnd Jaar Sal
--- ---- ---------
Jan 2005 19000.00
Feb 2005 20000.00
Maa 2005 20000.00
Apr 2005 22000.00
Mei 2005 23000.00

HISTORY
2004-12-04 - Created function
2014-10-21 - Renamed function from fun_maand to fun_date2month
2024-02-09 - Changed history table

TAGS
<program>
<description>Return the description of the month for a given date</description>
<generic>1</generic>
<author>Gerrit Mantel</author>
<created>2004-12-04</created>
<lastmodified>2024-02-09</lastmodified>
</program>
DescriptionReturn the description of the month for a given date
Minversion
Generic1
AuthorGerrit Mantel
Created2004-12-04 00:00:00
Lastmodified2024-02-09 00:00:00
Xp_cmdshell0
Ole_automation0
Subprogram_cnt0
Sourcecode