SQL Server从存储过程中调用存储过程选择查询

时间:2014-03-25 14:11:54

标签: sql-server stored-procedures

我们有一个存储过程如下:

ALTER PROCEDURE [dbo].[employeedetail]
AS
BEGIN
    SET NOCOUNT ON;

    SELECT ws.id as WorkflowStepId, 
    ws.workflow_id as WorkflowId,
    FROM [workflow_step] as ws 
    INNER JOIN [super_group] as sg on ws.workflow_id = sg.WORKFLOW_ID
    LEFT JOIN [alias] as alias on ws.id = alias.workflow_step_id
END

哪会给我类似的东西

100,200

我想要做的是对存储过程运行第一个值,这会将我的ID转换为地址

所以我想要

我的地址,200

所以我想做一些像

这样的事情
Select exec geo_sp_id_address_string(ws.id), ws.workflow_id......

但我无法正确理解语法,如果任何人有任何想法我怎么能让这个工作?

1 个答案:

答案 0 :(得分:0)

使用表变量

declare @MyTable table (id int, workflow_id int)

insert into @MyTable (id, workflow_id)
exec tmp.employeedetail

select geo_sp_id_address_string(id), workflow_id
from @MyTable