博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

查看存储过程,查看触发器,触发器使用例子

Posted on 2011-04-13 10:53  一刻  阅读(188)  评论(0)    收藏  举报

存储过程
select * from dbo.sysobjects where OBJECTPROPERTY(id, N'IsProcedure') = 1

触发器

select * from dbo.sysobjects where OBJECTPROPERTY(id, N'IsTrigger') = 1

 

查看某触发器

exec sp_helptext    PSafeGuidDel_PAgeBelongDel_PPayMentDelbyTravelDel     --空格后是触发器名称

 

//触发器使用例子

 

alter  trigger   tbHealth_Info_Del
on tbHealth_Info
for delete
as
begin
--删除特殊保障
delete tbProduct_SafeGuid_Special from tbProduct_SafeGuid_Special t,Deleted d   
where t.product_id=d.id and t.bigclass_id=d.bigclassId 

--删除重大疾病,住院医疗产品保额
delete tbHealthProductProtected from tbHealthProductProtected t,Deleted d
where t.productid=d.id
---重大疾病支付方式比例表
delete tbPayMenthod_ProductRate from tbPayMenthod_ProductRate t,Deleted d
where t.productid=d.id and t.bigclassid=d.bigclassid
--重大疾病价格表
delete tbHealthPrice from tbHealthPrice t,Deleted d  where t.productid=d.id
---住院医疗住院医疗价格表
delete  tbHealthHospitalPrice from tbHealthHospitalPrice t,Deleted d
where t.productid=d.id
end