USE OUTPUT PARAMETER IN STORED PROCEDURE

Ankit Singh

Total Post:341

Points:2389
Posted by  Ankit Singh
 692  View(s)
Ratings:
Rate this:
 I want to use output parameter in stored procedure please help me.
  1. aditya kumar Patel

    Post:254

    Points:1810
    Re: use output parameter in stored procedure

    Setting up output paramters for a stored procedure is basically the same as setting up input parameters, the only difference is that you use the OUTPUT clause after the parameter name to specify that it should return a value.  The output clause can be specified by either using the keyword "OUTPUT" or just "OUT".

    create proc Sp_EmpData

    (

    @totalcount int output

    )

    as

    begin

    select @totalcount=(select count(*) from Employee);

    end

    DECLARE @totalcount int

    EXEC Sp_EmpData @totalcount = @totalcount OUTPUT

    select @totalcount

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!