By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,528 Members | 1,305 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,528 IT Pros & Developers. It's quick & easy.

Call stored proc in stored proc with input and output param

P: 5
Hi ,

I have query on Stored proc

As

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

Expand|Select|Wrap|Line Numbers
  1. Create Proc  Sp_firstSP
  2. AS
  3. Begin 
  4. SET NOCOUNT ON 
  5.  
  6.  
  7. firstparameter1 varchar(20 ) , 
  8. secondparameter int , 
  9. thirdparameter varchar(20) 
  10.  
  11. BEGIN 
  12. IF ( status = 1 )
  13.   execute secondproc @inparam1 @inparam2 
  14.                      @outParam1   @outParam2 
  15.   update tablename1 set column1 =  @outParam1    , column2 = @outParam2 
  16.              where condition 
  17. 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
Oct 31 '12 #1
Share this Question
Share on Google+
5 Replies


Rabbit
Expert Mod 10K+
P: 12,430
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?
Oct 31 '12 #2

P: 5
it is in sql dear , u now sql server
Nov 1 '12 #3

Rabbit
Expert Mod 10K+
P: 12,430
You don't create applications in SQL Server. You must just mean T-SQL scripts.

You didn't answer my first question.
Nov 1 '12 #4

ck9663
Expert 2.5K+
P: 2,878
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
Nov 1 '12 #5

Frinavale
Expert Mod 5K+
P: 9,731
Check out this MSDN article about Using a Stored Procedure with Output Parameters.

-Frinny
Nov 1 '12 #6

Post your reply

Sign in to post your reply or Sign up for a free account.