sql server 查询某个表的所有触发器名称
2014-08-23 14:17
225 查看
查出所有用到某个表的SQL
select * from sysobjects where xtype='TR'
select * from sysobjects where xtype='TR' and parent_obj=object_id('表名')
xtype char(2) 对象类型。可以是下列对象类型中的一种:
C = CHECK 约束
D = 默认值或 DEFAULT 约束
F = FOREIGN KEY 约束
L = 日志
FN = 标量函数
IF = 内嵌表函数
P = 存储过程
PK = PRIMARY KEY 约束(类型是 K)
RF = 复制筛选存储过程
S = 系统表
TF = 表函数
TR = 触发器
U = 用户表
UQ = UNIQUE 约束(类型是 K)
V = 视图
X = 扩展存储过程
select name 表格名称 from sysobjects where xtype='U' AND id in(select parent_obj from sysobjects where xtype='TR')------查询有触发器的表
select name 表格名称 from sysobjects where xtype='U' AND id NOT in(select parent_obj from sysobjects where xtype='TR')------查询没有触发器的表
有多少触发器用下面的就行:
select a.name 数据表名,sysobjects.name as 触发器名,sysobjects.crdate as 创建时间 from sysobjects
left join (select *from sysobjects where xtype='U')as a on sysobjects.parent_obj=a.id
where sysobjects.xtype='TR'
select * from sysobjects where xtype='TR'
select * from sysobjects where xtype='TR' and parent_obj=object_id('表名')
xtype char(2) 对象类型。可以是下列对象类型中的一种:
C = CHECK 约束
D = 默认值或 DEFAULT 约束
F = FOREIGN KEY 约束
L = 日志
FN = 标量函数
IF = 内嵌表函数
P = 存储过程
PK = PRIMARY KEY 约束(类型是 K)
RF = 复制筛选存储过程
S = 系统表
TF = 表函数
TR = 触发器
U = 用户表
UQ = UNIQUE 约束(类型是 K)
V = 视图
X = 扩展存储过程
select name 表格名称 from sysobjects where xtype='U' AND id in(select parent_obj from sysobjects where xtype='TR')------查询有触发器的表
select name 表格名称 from sysobjects where xtype='U' AND id NOT in(select parent_obj from sysobjects where xtype='TR')------查询没有触发器的表
有多少触发器用下面的就行:
select a.name 数据表名,sysobjects.name as 触发器名,sysobjects.crdate as 创建时间 from sysobjects
left join (select *from sysobjects where xtype='U')as a on sysobjects.parent_obj=a.id
where sysobjects.xtype='TR'
相关文章推荐
- sql server 查询某个表的所有触发器名称
- sql server 查询某个表的所有触发器名称
- sql server 查询某个表的所有触发器名称
- sql server 查询某个表的所有触发器名称
- SQL Server查询数据库所有存储过程、触发器、索引信息SQL分享
- SQL Server查询所有存储过程信息、触发器、索引
- SQL Server查询所有存储过程信息、触发器、索引
- SQL Server查询数据库所有存储过程、触发器、索引信息SQL分享
- 如何查询数据库中的所有触发器名称,及启用还是禁用?!
- SQL Server查询所有存储过程信息、触发器、索引
- SQL Server查询数据库所有存储过程、触发器、索引信息SQL分享
- sql server 查询所有的数据库名称
- 如何编程ms sql server 2000 查询某个表的所有触发器名称
- SQL server 查询所有数据库 和数据库中的标
- 如何在oracle中查询所有用户表的表名、主键名称、索引、外键等
- 获得数据库名称///////查询数据库里所有表的sql语句!
- SQL查询所有数据库名称,表大小.
- 一条SQL语句查询数据库中的所有表、存储过程、触发器 (sysobjects表信息)
- 一条SQL语句查询数据库中的所有表、存储过程、触发器 (sysobjects表信息)
- 查询mysql中所有数据库名称