sqlserver 查询触发器、存储过程、视图、表
1.进入要查看触发器的数据库2.执行下面的语句查看所有触发器名称:select * from sysobjects where xtype='TR'3.执行下面的语句查看某条触发器的创建语句:exec sp_helptext '触发器名'SELECTobject_name(a.parent_obj) as [表],a.name as [触发器],(case when b.is_disabled=0
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' --所有表
更多推荐
所有评论(0)