简体   繁体   English

存储过程返回表

[英]return table on stored procedure

Can stored proc can use as table? 可以将存储的proc用作表吗? Im curious if stored proc can be used on joining in table or used in subquery here some sample that came in my mind 我很好奇存储的proc是否可以用于表中的连接或子查询中,这里是我想到的一些示例

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! (对不起,这是我第一次来这里)谢谢您,学习愉快!

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. 然后在查询中使用#tbl。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM