2个回答
展开全部
存储过程没有返回值,函数才有返回值,也可以返回一个表的数据,,不知道你所说的结果集是不是表的意思.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
create table test
(
id int identity primary key,
name varchar(50)
)
go
insert into test
select 'aaa' union
select 'bbb' union
select 'ccc'
go
select * from test
go
--创建存储过程
if exists(select * from sysobjects where name='proc_test1')
drop procedure proc_test1
go
create procedure proc_test1
as
begin
declare @table table(id int,name varchar(50))
declare @table1 table(id int,name varchar(50))
insert into @table select * from test
insert into @table1 select * from test
select * from @table
select * from @table1
end
--返回表
exec proc_test1
(
id int identity primary key,
name varchar(50)
)
go
insert into test
select 'aaa' union
select 'bbb' union
select 'ccc'
go
select * from test
go
--创建存储过程
if exists(select * from sysobjects where name='proc_test1')
drop procedure proc_test1
go
create procedure proc_test1
as
begin
declare @table table(id int,name varchar(50))
declare @table1 table(id int,name varchar(50))
insert into @table select * from test
insert into @table1 select * from test
select * from @table
select * from @table1
end
--返回表
exec proc_test1
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询