---
title: "存储过程中获取另一个存储过程返回的记录集"
author: "ch.net"
date: "2008-10-18T11:16:29Z"
tags: ["C", "C#", "C++"]
slug: "untitled"
draft: false
lastmod: "2008-10-18T11:16:29Z"
id: 254603
url: "https://haha-net.iteye.com/blog/254603"
---

调用　存储过程 A

返回　1     a

         2     b

         3     c

 

 

 

在存储过程 B 中

 

可以用 表变量 或 临时表 来,    获取　存储过程 A　中返回的记录

如：

 

declare  
  @tab table  
  (  
   id             int,     
   Name       nvarchar(50)  
  )

 

 

insert into @tab  
 exec  存储过程 A

 

-- 获取

select * from @tab

 

得到   1     a

         2     b

         3     c