|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, June 11, 2013 8:30 AM
Points: 1,106,
Visits: 1,792
|
|
Hey all,
Are there any known ways to decrypt the hex shown in sysprocesses on program name when the process is a sql agent job?
For example, I have a job running now and it shows up as: SQLAgent - TSQL JobStep (Job 0x3E31DB24ED72CD49A8114462A66A0367 : Step 1). I want to display the actual job name in place of the hex. Using fn_hex_to_char works:
SELECT name ,job_id ,'0x' + dbo.fn_hex_to_char(job_id,16) FROM msdb.dbo.sysjobs
... but I'd prefer to have a function that actually replaced the passed in hex with the appropriate char value.
Thanks
--
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, June 11, 2013 8:30 AM
Points: 1,106,
Visits: 1,792
|
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Tuesday, September 11, 2012 5:12 PM
Points: 18,
Visits: 35
|
|
The hex is the job_id for the job. You can query sysjobs and it will give you the name of the job.
e.g. select * from msdb..sysjobs where job_id = 0x1292021D3C929A4CBBE3895A61FA68CC
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, June 11, 2013 8:30 AM
Points: 1,106,
Visits: 1,792
|
|
akshay1974 (6/13/2008) The hex is the job_id for the job. You can query sysjobs and it will give you the name of the job.
e.g. select * from msdb..sysjobs where job_id = 0x1292021D3C929A4CBBE3895A61FA68CC
Negative, the program_name from sysprocesses does not match up to the job_id from sysjobs.
For example, I'm showing SQLAgent - TSQL JobStep (Job 0x3E31DB24ED72CD49A8114462A66A0367 : Step 1) in sysprocesses, yet the job_id for this job is 24DB313E-72ED-49CD-A811-4462A66A0367.
--
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Thursday, June 06, 2013 9:12 AM
Points: 6,260,
Visits: 1,980
|
|
Adam Bean (6/13/2008)
akshay1974 (6/13/2008) The hex is the job_id for the job. You can query sysjobs and it will give you the name of the job.
e.g. select * from msdb..sysjobs where job_id = 0x1292021D3C929A4CBBE3895A61FA68CCNegative, the program_name from sysprocesses does not match up to the job_id from sysjobs. For example, I'm showing SQLAgent - TSQL JobStep (Job 0x3E31DB24ED72CD49A8114462A66A0367 : Step 1) in sysprocesses, yet the job_id for this job is 24DB313E-72ED-49CD-A811-4462A66A0367.
select j.name from msdb.dbo.sysjobs j inner join msdb.dbo.sysjobsteps s on j.job_id = s.job_id where step_uid = '3E31DB24ED72CD49A8114462A66A0367' --job step id
* Noel
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, June 11, 2013 8:30 AM
Points: 1,106,
Visits: 1,792
|
|
Not the same number there either.
step_uid = 55060C17-0964-459C-A338-9ADF1C40384F sysprocesses program_name = 0x3E31DB24ED72CD49A8114462A66A0367
--
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Thursday, June 06, 2013 9:12 AM
Points: 6,260,
Visits: 1,980
|
|
From your Post:
For example, I'm showing SQLAgent - TSQL JobStep (Job 0x3E31DB24ED72CD49A8114462A66A0367 : Step 1) in sysprocesses, yet the job_id for this job is 24DB313E-72ED-49CD-A811-4462A66A0367.
IF you replace 0x3E31DB24ED72CD49A8114462A66A0367 in the query I posted for '3E31DB24ED72CD49A8114462A66A0367'
it will show the running jobname --- Note: NO 0x, single-quoted AND NO "-".
* Noel
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, June 11, 2013 8:30 AM
Points: 1,106,
Visits: 1,792
|
|
Not sure If I'm following you here ...
sysjobs: - job_id = 24DB313E-72ED-49CD-A811-4462A66A0367
sysjobsteps: - step_uid = 55060C17-0964-459C-A338-9ADF1C40384F
sysprocesses: - program_name = 0x3E31DB24ED72CD49A8114462A66A0367
How can I get that program_name to match up to the job or the jobstep? The number does not match ... regardless to as of the prefix 0x. The program_name and job_id are similar towards the end, but that's about it.
--
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Tuesday, September 11, 2012 5:12 PM
Points: 18,
Visits: 35
|
|
The hex is the job_id. Try the below
select * from msdb..sysjobs where job_id = 0x3E31DB24ED72CD49A8114462A66A0367
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, June 11, 2013 8:30 AM
Points: 1,106,
Visits: 1,792
|
|
akshay1974 (6/13/2008) The hex is the job_id. Try the below
select * from msdb..sysjobs where job_id = 0x3E31DB24ED72CD49A8114462A66A0367
Woah, how is this possible? How can I convert that number to match the job_id?
--
|
|
|
|