首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

请教存储过程中可以调用自身存储过程吗

2012-01-05 
请问存储过程中可以调用自身存储过程吗?RT[解决办法]求:5drop proc p10create proc p10 (@in int, @out in

请问存储过程中可以调用自身存储过程吗?
RT

[解决办法]
求:5

drop proc p10
create proc p10 (@in int, @out int output) as
declare @o1 int
declare @i1 int
if @in <= 1
set @out = 1
else
begin
set @i1 = @in - 1
exec sp_executesql N 'exec p10 @i1, @o1 output ',
N '@i1 int, @o1 int output ',
@i1, @o1 output

set @out = @in * @o1
end
return

declare @o1 int
exec p10 5, @o1 output
select @o1

热点排行