SQLSERVER
如何查看之前執行過的存儲過
select [text] from syscomments where id=object_id('存儲過程名字')exec sp_helptext parseBranch 查看存儲過程的txt文本
as
begin
declare @_pkid int
declare cur CURSOR local FOR SELECT pkid FROM t_branch WHERE fkparent=@_parentid --AND status=0;
open cur;
fetch cur into @_pkid;
while (@@fetch_status=0)
begin
update t_branch set lft=@_index where pkid= @_pkid;
set @_index=@_index+1;
exec parseBranch @_pkid,@_index output;
update t_branch set rgt=@_index where pkid= @_pkid;
set @_index=@_index+1;
fetch cur into @_pkid;
END
close cur
deallocate cur
end;