The other two sets seem to be reversed..sysjobs...job_id ------------------------------------ AAC17DBA-838F-43DA-8735-BCCD9BDDD98Csysprocesses...(formatted)BA7DC1AA-8F83-DA43-8735-BCCD9BDDD98C
How about:create table #xp_results( job_id uniqueidentifier not null, last_run_date int not null, last_run_time int not null, next_run_date int not null, next_run_time int not null, next_run_schedule_id int not null, requested_to_run int not null, -- bool request_source int not null, request_source_id sysname collate database_default null, running int not null, -- bool current_step int not null, current_retry_attempt int not null, job_state int not null )insert #xp_results exec master.dbo.xp_sqlagent_enum_jobs @is_sysadmin = 1, @job_owner = ''select job_id as running_jobs from #xp_results where running = 1
rockmoose/* Chaos is the nature of things...Order is a lesser state of chaos */