December 31, 2004 at 12:10 pm
Has anyone successfully used msdb.dbo.sp_add_job to create a job with the @owner_login_name parameter? It says you can do that in BOL, but it seems to just ignore the parameter and instead creates it with the current login name.
December 31, 2004 at 12:20 pm
I was able to do so on my test server just now. Did the following:
DECLARE @jobid uniqueidentifier
EXEC msdb.dbo.sp_add_job @job_name = 'test', @owner_login_name = 'sa', @job_id = @jobid OUTPUT
PRINT @jobid
Also tried it with a Windows account and that was reflected correctly.
K. Brian Kelley
@kbriankelley
December 31, 2004 at 3:51 pm
Dang. I was hoping someone would come back with, "yep, that's a known bug". That's how I call it, too.
declare @ReturnCode int
, @jobID uniqueidentifier
EXECUTE @ReturnCode = msdb.dbo.sp_add_job
@job_id = @JobID OUTPUT
, @job_name = 'NextTestJob'
, @owner_login_name = 'IDBR_Admin'
, @enabled = 1
select suser_sname(owner_sid)
from msdb.dbo.sysjobs where job_id = @JobID
The select returns my domain login instead of 'IDBR_Admin'. I also tried it with another domain login (besides mine) and it still returns mine. Any ideas?
Thanks, Dave
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply