在一个名为DEMO的数据库存在的很多表,有没有什么方法可以一次把包涵触发器的表给过滤出来啊?

解决方案 »

  1.   

    SELECT object_name(parent_obj) FROM sysobjects s WHERE xtype='tr' 
      

  2.   


    select distinct b.name from sysobjects a,sysobjects b where a.xtype='TR' and b.Xtype='U'
    and a.parent_obj=b.id
      

  3.   

    select * from sysobjects a where exists(select 1 from sysobjects where parent_obj=a.ID and xtype='tr')
      

  4.   


    select distinct b.name from sysobjects a,sysobjects b where a.xtype='TR' and b.Xtype='U'
    and a.parent_obj=b.id也就是触发器也是一个对象,它的信息存放在sysobjects这张表中,表中xtype(类型)为'TR'(trigger)的就是trigger了