1)
disable trigger all on dbo.Part_Mobile--禁用触发器
go
update Part_Mobile
set
--select
verify_id=(
case when Count_NoExists>0 then 0
when Count_Error>0 then 1
when Count_Refuse>0 then 2
when Count_Busy>0 then 3
when Count_Correct>0 then 4 end
),
verify_dtm=isnull(verify_dtm,in_date)
--,*
from Part_Mobile
where Count_NoExists+
Count_Error+Count_Refuse
+Count_Busy+Count_Correct>0
and Verify_ID=255
go
enable trigger all on dbo.Part_Mobile--启用触发器
2)
USE [SINO]
GO
/****** Object: Trigger [dbo].[TR_CATI_insert_Test_Mobile] Script Date: 12/02/2010 11:12:48 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[TR_CATI_insert_Test_Mobile]
ON [dbo].[Test_Mobile]
AFTER insert
AS
BEGIN
SET NOCOUNT ON;
if exists(select * from inserted where 是CATI=1)
begin
alter table Item_Insurance..Main_Mobile
disable trigger all --禁用触发器
merge Item_Insurance..Main_Mobile m
using (select * from inserted where 是CATI=1
and Item_Insurance.dbo.f_is_mobile(mobile)=1) s
on m.mobile=s.mobile
when matched
then update set
m.pt_id=
(case s.PCT_ID when -1 then 2 when 0 then 1 end)
,m.test_date=s.Test_Time
when not matched
then insert (mobile,pt_id,test_date,mly_id)
values(s.mobile,(case s.PCT_ID when -1 then 2 when 0 then 1 end),Test_Time,145) ;
print 'CATI测号更新Item_Insurance..Main_Mobile'+convert(varchar,@@rowcount)+'条!'
alter table Item_Insurance..Main_Mobile
enable trigger all --启用触发器
end
END