存储过程系列之存储过程sql查询存储过程的使用

本文提供SQL查询方法,用于分析特定表在哪些存储过程中被使用及是否进行了更新操作,以及如何获取当前数据库中所有存储过程。

1.查询某个表被哪些存储过程(以下简称 SP)使用到 :

 select distinct object_name(id) from syscomments where id in

 (select object_id from sys.objects where type ='P') and text like'%TableName%'

 

2.查找那些过程对该表做了更新操作:

 select distinct object_name(id) from syscomments where id in

 (select object_id from sys.objects where type ='P') and text like'%update tablename%'

 

3.查询当前数据库中所有SP:

 select name as 存储过程  from sysobjects where type = 'P'

 

SQL server 查询某个表在哪些存储过程(SP)中使用

1.查询某个表被哪些存储过程(以下简称 SP)使用到 :

select distinct object_name(id) from syscomments where id in

(select object_id from sys.objects where type ='P') and text like'%TableName%'

 

2.查找那些过程对该表做了更新操作:

select distinct object_name(id) from syscomments where id in

(select object_id from sys.objects where type ='P') and text like'%update tablename%'

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值