arşiv

0, 2018 için arşiv

Get running job name from sysprocesses

Cuma, 06 Tem 2018 yorum yok

Get the substring of the running job from sysprocess .. have filtered out generic refresher ETC

select substring(program_name,55,7) ‘to search’
from master..sysprocesses
where program_name like ‘%agent%’ and program_name not like ‘%DatabaseMail – SQLAGENT -%’
and program_name not in (‘SQLAgent – Alert Engine’,’SQLAgent – Generic Refresher’,’SQLAgent – Email Logger’,’SQLAgent – Job invocation engine’,’SQLAgent – Job Manager’)

output will be similar to below

Output :

to search
2FE3386
A68D437
3253286

Get the job details from MSDB database by using the results you got from above query and replace them in where clause

select *
from msdb..sysjobs
where job_id like ‘%A68D437%’

OR

if you have more than one job running replace below job_id %strings%

select *
from msdb..sysjobs
where job_id like ‘%A68D437%’ or job_id like ‘%4E742EB%’ or job_id like ‘%FAEDF18%’

 

Categories: SQL Hakkında Tags: