Advertisement

Latest Post

Thursday, 1 December 2016

How to call a function in Procedure

How to call a function in Procedure?

  Step1: create a function

              create function fn_SumOftwoNumber(@NumIst int,@NumpIInd int)
returns int
as begin
Declare @Result as int
Set @Result=@NumIst+@NumpIInd
return @Result
end

  Step2: Call a function in store procedure 

create procedure sp_Test_Callfunction
(
 @IstVar int,
 @IIndVar int
)
as begin
Declare @sp as int
set @sp=dbo. fn_SumOftwoNumber (@IstVar,@IIndVar)
print @sp
end

 Step3: Execute Store procedure for Output

     
      EXEC sp_Test_Callfunction  45,60

Step3:  Output: - 105

Government Jobs