Question

Can stored proc can use as table? Im curious if stored proc can be used on joining in table or used in subquery here some sample that came in my mind

Select * from table00 tab
Left join (mystoredproc 'param1', 'param2') st
On tab.col1 = st.col1
Where st.col2 = '1'

Or something like

Select * from table00
Where col1 in (select col1 from mystoredproc 'param')

Is it possible? I know i can do this on function but i just wonder if it can

(sorry for the grammar this is my 1st time on here) Thank you and happy learning!

Was it helpful?

Solution

No, stored procedre doesn't return a table and cannot be used as a query source.

What can be done is

INSERT #tbl EXEC <proc_name< {params}

And then use the #tbl in queries.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top