SQLTeam.com | Weblogs | Forums

SELECT statement on a stored procedure

Hello,
I have a long stored procedure that get me a SELECT of many
fields in many tables, passing one parameter of type INT.

Is it possible execute a SELECT statement on this stored procedure
with a WHERE clause?

For example, something like this:

SELECT *
FROM
EXEC myStored 101
WHERE Field1 = 'test';

Thank you in advance.

Luis

hi hope this link helps !!! :slight_smile: :slight_smile:

https://ask.sqlservercentral.com/questions/28987/applying-where-clause-to-stored-procedure-result.html

1 Like

So, using a temporary table, like this:

INSERT INTO #CompleteExec
EXEC myStored 101;

SELECT *
FROM #CompleteExec
WHERE Field1 = 'test';

Thank you for the advice Harish.

Luis