IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_sys_gen_all]') AND type = 'P')
DROP PROCEDURE [dbo].[mps_sys_gen_all]
GO
create procedure [dbo].[mps_sys_gen_all](
@cmpid int 
)
as
begin
declare @sql nvarchar(4000) 
declare status1 cursor LOCAL FORWARD_ONLY READ_ONLY for
  select biz_id  from mps_biztype  where biz_cmpid=@cmpid 
  open status1
  declare @ord2tag int 
  FETCH NEXT FROM status1 INTO @ord2tag 
  WHILE (@@FETCH_STATUS = 0)
  BEGIN
   set @sql = 'exec mps_gen_biz_base_proc '+convert(varchar(10),@cmpid)  +','+convert(varchar(10),@ord2tag)
exec(@sql)
   FETCH NEXT FROM status1 INTO @ord2tag 
  END
  CLOSE status1
DEALLOCATE status1 
end