I have the three declare items I need to add as a function and then called in a stored procedure. I have the three items and then an example of how I believe it should look like in as a function.
Declare @Multiplier int
Set @Multiplier = Day(@ReportEndDate)
Declare @NumberofDays int
Set @NumberofDays = Day(DateAdd(d,-Day(DateAdd
(m,1,@Repo
rtEndDate)
),DateAdd(
m,1,@Repor
tEndDate))
)
Declare @Ratio float
Set @Ratio = Convert(float,Cast(@Number
OfDays as float)/Cast(@Multiplier as float))
Example:
CREATE FUNCTION [dbo.multiplier] @Multiplier int
RETURNS varchar(31) AS
BEGIN
Declare @Multiplier int
Set @Multiplier = Day(@ReportEndDate)
select @Multiplier = @Multiplier
return @Multiplier
END
Next I would need a reference on how to call the function in the stored procedure
Start Free Trial