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