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 2000 Forums
 Transact-SQL (2000)
 jobs and stored procedures.

Author  Topic 

dpais
Yak Posting Veteran

60 Posts

Posted - 2008-08-19 : 10:13:46
is there a way i can get the job name that runs a speceific stored procedure as a step ...

therefore i have a job lets say job_nightly_backup_run that has 1 job step that runs stored procedure sp_combine_all_tables ....

then i will need to query sp_combine_all_tables somehow and then get an output of job_nightly_backup_run .....

alternatively --- is there any way i can see at what times a stored procedure is run by which user .....

thanks.

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-08-19 : 10:19:46
you have to capture with profiler.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-19 : 10:20:11
have a look at sysjobs and sysjobsteps system tables.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-19 : 10:23:48
i think what you could do is use a query like this

select distinct j.jobname
from sysjobs j
inner join sysjobsteps js
on js.job_id=j.job_id
where js.command like '%sp_combine_all_tables%'

then look at job schedule in sql agent for returned job to understand when it will execute the sp.
Go to Top of Page
   

- Advertisement -