SQL-查询所有触发器

来源:互联网 发布:淘宝店铺推广工具 编辑:程序博客网 时间:2024/06/16 09:46

----查看所有角本
Create table #y (txt text)

select name, iid = identity(int,1,1) into #x from SysObjects where xtype = 'TR'

declare @i int, @max int
declare @name varchar(40)

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)
    set @i = @i + 1
end

select * from #y

drop table #x
drop table  #y

原创粉丝点击