create proc test11
@id int
as
begin
print @id
set @id = @id -1
if @id > 0
begin
if @@NESTLEVEL<32 --化解超过32层
exec test11 @id
end
end
go
执行:exec test11 42
create proc test11
@id int
as
begin
print @id
set @id = @id -1
if @id > 0
begin
if @@NESTLEVEL<32 --化解超过32层
exec test11 @id
end
end
go
执行:exec test11 42