导航
  • 主页
  • 基础类
  • 应用实例
  • 新技术前沿

存储过程中调用存储过程的问题

zyb51 2007-12-13 03:01:39
CREATE Procedure a
as
begin
SELECT top 1 id,name from users
end
GO

我在另一个存储过程中怎么得到这a返回的id,与name呢??
...全文
53 点赞 收藏 5
写回复
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
daviszr_1979 2007-12-13
Create Table aa(id int, name nvarchar(20))


Insert aa(id,name) select 1,'张三'


Create PROCEDURE B
As
Declare @id int,
@Name nvarchar(20)
Set @id = 0
Set @Name = ''
Exec A @id,@Name
print @id
Print @Name


Create Proc A
@id int Output,
@Name nvarchar(20) Output
as
Select @id=id, @Name=Name From aa
回复
zyb51 2007-12-13
谢谢
回复
kk19840210 2007-12-13
alter   Procedure   a  
@id int output,@name int output
as
begin
SELECT top 1 @id=id,@name=name from users
end

create proc test
as
begin
declare @id varchar(10),@name varchar(10)
exec a @i output ,@name output --得到 id ,name
select @i
select @sum
end
回复
chuifengde 2007-12-13
create proc a 
@id int output,
@name varchar(20) output
as
select top 1 @id=id,@name=name from [users]


create proc b
as
declare @idB int,@nameB varchar(20)
exec a @idB out,@nameB out
select @idB,@nameB
回复
-狙击手- 2007-12-13
create proc b
as
begin
declare @t table(id int,name varchar(20))
insert @t exec a
...

end
回复
发动态
发帖子
MS-SQL Server
创建于2007-09-28

3.2w+

社区成员

MS-SQL Server相关内容讨论专区
申请成为版主
社区公告
暂无公告