Wednesday, 26 July 2017

Get Month No Scalar Valued Function MS Sql






ALTER FUNCTION [dbo].[GetMonthNo]
(
@MonthName NVARCHAR(50)
)
RETURNS NVARCHAR(MAX)
AS
BEGIN

RETURN(CASE @MonthName
   WHEN 'january' THEN 1
   WHEN 'february' THEN 2
   WHEN 'march' THEN 3
   WHEN 'april' THEN 4
   WHEN 'may' THEN 5
   WHEN 'june' THEN 6
   WHEN 'july' THEN 7
   WHEN 'august' THEN 8
   WHEN 'september' THEN 9
   WHEN 'october' THEN 10
   WHEN 'november' THEN 11
   WHEN 'december' THEN 12
   ELSE  '' END)

END

No comments:

Post a Comment

React Hooks - custom Hook

  v CustomHook Ø React allows us to create our own hook which is known as custom hook. Example – 1 localStorage Demo Step-1 Create ...