SQL如何查询对应的Object
编写人:CC阿爸
2014-6-17
在日常SQL数据库的操作中,常常需要查询那些对象,如那些sp会包括对该表的操作,那些job会对应执行该sp等相关内容。总之是快捷的修改与之有关的内容。
select b.name
from syscomments a,sysobjects b where a.id=b.id and b.xtype='P' and a.text like '%指定内容%'
select * from syscomments where text like '%Job_CalKPI%'
SELECT * FROM sysobjects WHERE xtype='P'
SELECT * FROM sysobjects WHERE id='373784589'
select * from syscomments where id='2137878783'
sp_help_job
select * from msdb.dbo.sysjobs
select * from msdb.dbo.sysjobschedules
select b.job_id, b.name,b.description,b.enabled from msdb.dbo.sysjobsteps s ,msdb.dbo.sysjobs b
where s.job_id=b.job_id and s.command like '%指定内容%'