您的位置: 龙岩金蝶软件论坛 -> 企业管理软件区域 -> 数据库 -> 查询所有触发器和触发器在哪张表及查询触发... 
本帖共有410个阅读者
发表帖子 发表投票 回复主题
查询所有触发器和触发器在哪张表及查询触发器里面包含哪些内容
尊贵身份标志
cyy275(管理员)
cyy275
头衔:社区公民
帮派:无帮无派
帖数:497
金钱:100000
积分:2248
注册时间:2017-5-8
楼主信息 | 留言 | Email | 主页 | 编辑 | 管理 | 离线
查询所有触发器和触发器在哪张表及查询触发器里面包含哪些内容
select triggers.name as [触发器],tables.name as [表名],triggers.is_disabled as [是否禁用],
triggers.is_instead_of_trigger AS [触发器类型],
case when triggers.is_instead_of_trigger = 1 then 'INSTEAD OF'
when triggers.is_instead_of_trigger = 0 then 'AFTER'
else null
end as [触发器类型描述]
from sys.triggers triggers
inner join sys.tables tables on triggers.parent_id = tables.object_id
where triggers.type ='TR' and triggers.name='SRM_CGDD_ZQ'
order by triggers.create_date


--查询触发器里面包含哪些内容
set nocount on
Create table #y (Trname varchar(50),txt text)
select name, iid = identity(int,1,1) into #x from SysObjects where xtype = 'TR'
declare @i int, @max int
declare @name varchar(50)
set @i = 1
select @max = max(iid) from #x
while @i <= @max
begin
select @name = name from #x where iid = @i
insert #y (txt)
exec('sp_helptext ' + @name)
update #y
set Trname=@name
where Trname is null
set @i = @i + 1
end
select * from #y where txt LIKE '%采购%'
drop table #x
drop table  #y

set nocount off




select triggers.name as [触发器],tables.name as [表名度],triggers.is_disabled as [是否禁用知],
triggers.is_instead_of_trigger AS [触发器类型道版],
case when triggers.is_instead_of_trigger = 1 then 'INSTEAD OF'
when triggers.is_instead_of_trigger = 0 then 'AFTER'
else null
end as [触发器类型描权述]
from sys.triggers triggers
inner join sys.tables tables on triggers.parent_id = tables.object_id
where triggers.type ='TR' and triggers.name like '%mycyy%'
order by triggers.create_date



「该帖子被 cyy275 在 2020/4/23 17:27:14 编辑过」

今天的努力,明天的享受!
今天的无为,明天的无助!
今天的迷茫,明天的受累!
等级:管理员 参考IP地址:*.*.*.*
2019-1-23 9:39:42
Powered by 金蝶论坛 Copyright © 2011 www.xxhcom.cn. All rights reserved.