1.进入要查看触发器的数据库
2.执行下面的语句查看所有触发器名称:
select * from sysobjects where xtype='TR'
3.执行下面的语句查看某条触发器的创建语句:
exec sp_helptext '触发器名'

SELECT
object_name(a.parent_obj) as [表]
,a.name as [触发器]
,(case when b.is_disabled=0 then '使用中' else '停用' end) as [触发器状态]
,b.create_date as [写入日期]
,b.modify_date as [最后修改日期]
,c.text as [触发器内容]
FROM sysobjects a
INNER JOIN sys.triggers b ON b.object_id=a.id
INNER JOIN syscomments c ON c.id=a.id
WHERE a.xtype='tr' 
ORDER BY [表]

select name from sysobjects where xtype='P' --所有存储过程

select name from sysobjects where xtype='V' --所有视图

select name from sysobjects where xtype='U' --所有表
 


 

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐