我需要在 select 语句中访问存储过程的结果,即:
I need to access the result of a stored procedure within a select statement, i.e.:
SELECT * FROM [dbo].[sp_sample]在 SQL_Server 2005 中.
in SQL_Server 2005.
推荐答案@Barry 是对的您需要先创建一个临时表并插入其中,然后在您的选择中加入该表.
@Barry is right you need to create a temp table and insert into it first, then join that table in your select.
但是,存储过程之间共享数据的方法有很多种,请参阅这篇优秀文章:How to ShareErland Sommarskog 的存储过程之间的数据
However, there are numerous ways for sharing data between stored procedures, see this excellent article: How to Share Data Between Stored Procedures by Erland Sommarskog
一种可能对您有用的方法是共享"临时表.#temp 表是在 Parent 过程中创建的,可供 Child 使用:www.sommarskog.se/share_data.html#temptables
One method that may work for you is to "share" a temp table. The #temp table is created in the Parent procedure and can be used by the Child: www.sommarskog.se/share_data.html#temptables
更多推荐
在 Select 中使用存储过程 (T
发布评论