I have a Stored Procedure(SP) in MS SQL 2008 R2 I’m building that requires a list of users to narrow down the data returned.
The system I’m working on has a GetUsers SP which returns a list of users, and I need to then use this to limit the results returned from the SP I am working on myself.
I’ve had a look at TABLE variables, but not sure if this is quite what I need.
How would I go about integrating the results of one SP into the where clause of another SP?
You can take the results of your SP by
Then
Or
Alternatively, if possible, you could convert GetUsers to a table valued function.