IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_tool_gen_bizall]') AND type = 'P')
DROP PROCEDURE [dbo].[mps_tool_gen_bizall]
GO
create procedure [dbo].[mps_tool_gen_bizall] 
(
@cmpid int
)
as  
begin  
  
    declare status1 cursor LOCAL FORWARD_ONLY READ_ONLY for  
  select biz_id   from mps_biztype  with(nolock) where  biz_cmpid=@cmpid 
declare @bizid int 
  open status1  
  FETCH NEXT FROM status1 INTO @bizid 
  WHILE (@@FETCH_STATUS = 0)  
  BEGIN  

BEGIN TRY 
   BEGIN TRAN 
   exec mps_gen_biz_base_proc @cmpid , @bizid 
COMMIT TRAN -------提交事务
END TRY-----------结束捕捉异常
BEGIN CATCH------------有异常被捕获
IF @@TRANCOUNT > 0---------------判断有没有事务
BEGIN
ROLLBACK TRAN----------回滚事务
END 
print 'biz='+convert(varchar(10),@bizid)+'
'+ERROR_PROCEDURE()+' line='+convert(varchar(10),ERROR_LINE())+'
'+ERROR_MESSAGE() 
END CATCH--------结束异常处理
FETCH NEXT FROM status1 INTO @bizid 
  END  
  CLOSE status1  
  DEALLOCATE status1   

 
    
end