UFN_FISCALYEAR

Return

Return Type
smallint

Parameters

Parameter Parameter Type Mode Description
@MONTH_FY_ENDS tinyint IN
@DATE date IN

Definition

Copy

create function BBDW.[UFN_FISCALYEAR](@MONTH_FY_ENDS tinyint,@DATE date)
returns smallint
-- Input the Month (1 to 12) the Fiscal Year ends and the Date 
-- Returns the Fiscal Year of the date
begin

  declare @FY smallint;

  if month(@DATE) > @MONTH_FY_ENDS
  begin
    set @FY=year(@DATE)+1;
  end
  else
  begin
    set @FY=year(@DATE);
  end

  return @FY;

end