22,209
社区成员
发帖
与我相关
我的任务
分享
CREATE PROCEDURE pr_fab
(
@id AS int
)
AS
BEGIN
DECLARE @tempId int
IF (dbo.fn_hasChildren(@id)>0)
BEGIN
DECLARE @temp TABLE(id int)
INSERT INTO @temp(id) SELECT agentsid FROM Sheet1 WHERE enrollerid=@id
WHILE EXISTS(SELECT id from @temp)
BEGIN
SET ROWCOUNT 1
select @tempId = [id] from @temp
dbo.pr_fab(@tempId)
SET ROWCOUNT 0
delete from @temp where [id] = @tempId
END
END
END