Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Need to query jobs and reports for stored proc

Author  Topic 

stonebreaker
Yak Posting Veteran

92 Posts

Posted - 2009-12-16 : 13:45:59
As the title says, I need to find out if any jobs, maintenance plans, reports, or ssis packages use a certain stored proc. We are cleaning up the database, and want to know if it is OK to delete.

Thanks,

Stonebreaker
The greatest obstacle to discovery is not ignorance - it is the illusion of knowledge.
-Daniel Boorstin

Vinnie881
Master Smack Fu Yak Hacker

1231 Posts

Posted - 2009-12-16 : 16:27:08
I have never done this, but I would start by looking at the system tables for each one. I just did google search's for the following terms and this is what I found.

Query Sql Jobs - http://sqlserverpedia.com/wiki/SQL_Server_Agent_Job_Query_Samples
Query Sql Maintenance Plans - http://www.mssqltips.com/tip.asp?tip=1137
QUery SQL SSIS packages - I think you're going to need to disect from looking at the packages

You should be able to hopfully piece it apart, but like I said this is just how I would approach, I have never needed to do this prior.


Success is 10% Intelligence, 70% Determination, and 22% Stupidity.
\_/ _/ _/\_/ _/\_/ _/ _/- 881
Go to Top of Page

stonebreaker
Yak Posting Veteran

92 Posts

Posted - 2009-12-16 : 16:53:23
Thanks for the tip on the msdb tables - I was able to find a couple, dbo.sysjobs and dbo.sysjobsteps, that will let me find what I need for jobs. I'll keep researching the rest.

select sj.name
,sjs.step_id
,sjs.step_name
,sjs.command
from dbo.sysjobs sj
join dbo.sysjobsteps sjs on sj.job_id = sjs.job_id
where command like '%search_condition%'

Stonebreaker
The greatest obstacle to discovery is not ignorance - it is the illusion of knowledge.
-Daniel Boorstin
Go to Top of Page
   

- Advertisement -