Call stored proc in stored proc with input and output param

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kumarlalit
    New Member
    • Oct 2012
    • 5

    Call stored proc in stored proc with input and output param

    Hi ,

    I have query on Stored proc

    As

    I am writing a stored proc in which another sp is running , so my query is

    Code:
    Create Proc  Sp_firstSP
    AS
    Begin 
    SET NOCOUNT ON 
    
    
    firstparameter1 varchar(20 ) , 
    secondparameter int , 
    thirdparameter varchar(20) 
    
    BEGIN 
    IF ( status = 1 )
      execute secondproc @inparam1 @inparam2 
                         @outParam1   @outParam2 
      update tablename1 set column1 =  @outParam1    , column2 = @outParam2 
                 where condition 
    END


    -- now here my query is how can i get the outparam in my firtsp so that it will become the input of the firstsp

    How can i write the stored proc for use in my current application
    Last edited by Rabbit; Oct 31 '12, 06:25 PM. Reason: Please use code tags when posting code.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    I have no idea what this means:
    how can i get the outparam in my firtsp so that it will become the input of the firstsp
    Your first stored proc has no out params.

    I have no idea what this means either:
    How can i write the stored proc for use in my current application
    What application? What is it written in? VB.NET? C++? C? Java?

    Comment

    • Kumarlalit
      New Member
      • Oct 2012
      • 5

      #3
      it is in sql dear , u now sql server

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        You don't create applications in SQL Server. You must just mean T-SQL scripts.

        You didn't answer my first question.

        Comment

        • ck9663
          Recognized Expert Specialist
          • Jun 2007
          • 2878

          #5
          I think Kumarlalit knows how to create basic SP that does not have parameter. You can define input and output parameter for stored procedure. Depending on how you need it, you might need to create it as a function instead.

          Check Books Online on the full syntax of creating SP.

          Happy Coding!!!


          ~~ CK

          Comment

          • Frinavale
            Recognized Expert Expert
            • Oct 2006
            • 9749

            #6
            Check out this MSDN article about Using a Stored Procedure with Output Parameters.

            -Frinny

            Comment

            Working...