Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
delbar
Starting Member
5 Posts |
Posted - 2009-11-17 : 04:44:25
|
| I have to call a sproc that has a parameter and returns a result set from sproc2 - I will need to reference the parameter from sproc1. How is this done? Do I need to set my own variable or param and set it to the param i the first sproc?Please help - have never worked with this and can't seem to figure this out.thanks,delbar |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2009-11-17 : 11:15:43
|
Not really sure what you're asking. But the simple interpretation is:--SP1declare @localVar intset @localVal = 10exec SP2 @parameter1 = @localVar now both SPs have access to the same value (SP1-@localVar; SP2-@parameter1)Or perhaps you need to set the value in SP2 and then use it in SP1. In that case you need to use an OUTPUT parameter:declare @localVar intexec SP2 @parameter1 = @localVar OUTPUT --SP2 @parameter1 is defined with OUTPUT as wellselect @localVar as [ValueSetInSP2] Be One with the OptimizerTG |
 |
|
|
|
|
|