More detail as requested on another post.
I am sysadmin. The owner of the job is sysadmin. When I manually run the job I get an email stating:
The host MyServer has logged in with the functional login 'sa' using SQLAgent - TSQL JobStep (Job 0x2E8AC23BE1934F499506377F463F3BF6 : Step 1). They are using SPID 115.
This email is part of our Login Auditing process. We pull the values from the below code snippet:
SELECT
@@SERVERNAME,
p.hostname,
p.spid,
p.dbid,
p.login_time,
p.last_batch,
p.loginame,
d.[name],
p.PROGRAM_NAME
FROM master.dbo.sysprocesses p (nolock)
INNER JOIN master.sys.databases d ON p.dbid = d.database_id
The 'sa' part of that email comes from p.loginame, which in turn comes from master.dbo.sysprocesses.
So, could this be a dirty data issue (because of the nolock) or is this something else?
I'm certainly not logging in as SA. I'm logged in under my Windows account.